rizzo-next
Version:
The next generation of Lonely Planet's style guide and pattern library.
26 lines (19 loc) • 570 B
JavaScript
import CookieUtil from "../../../src/core/cookie_util";
let expect = require("expect.js");
/** @test {CookieUtil} */
describe("cookie util", () => {
let cookie = null;
before(() => {
cookie = new CookieUtil({
cookies: ""
})
});
it("should set a cookie", () => {
cookie.setCookie("testKey", "testValue");
expect(cookie.cookies).to.be("testKey=testValue;path=/");
});
it("should set a cookie that expires", () => {
cookie.setCookie("testKey", "testValue", 14);
expect(/expires=/.test(cookie.cookies)).to.be(true);
});
});