Final cookie tests
This commit is contained in:
parent
4be83e9649
commit
67c9b1609b
1 changed files with 26 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import {
|
|||
setSessionKeyIfUnset,
|
||||
setSessionIdIfUnset,
|
||||
isCookieSet,
|
||||
refreshCookieExpiration,
|
||||
} from "@/helpers/heritage-integration/cookie-helper.js";
|
||||
import { cookieNames } from "@/constants/cookie-names";
|
||||
import { removeAllTestCookies, setupCookies, setupCrypto } from "@/helpers/unit-test-helper";
|
||||
|
|
@ -375,4 +376,29 @@ describe("cookies", () => {
|
|||
expect(result).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("refreshCookieExpiration", () => {
|
||||
test("Preserves value", () => {
|
||||
// Arrange
|
||||
setupCookies({});
|
||||
|
||||
// Act
|
||||
const result1 = getSessionIdValue();
|
||||
refreshCookieExpiration(cookieNames.SESSION_ID, 1000000);
|
||||
const result2 = getSessionIdValue();
|
||||
|
||||
// Assert
|
||||
expect(result1).toBe(result2);
|
||||
});
|
||||
|
||||
test("Does not set cookie if not already set", () => {
|
||||
// Arrange
|
||||
|
||||
// Act
|
||||
refreshCookieExpiration(cookieNames.SESSION_ID, 1000000);
|
||||
const result = isCookieSet(cookieNames.SESSION_ID);
|
||||
|
||||
expect(result).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue