mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 14:00:21 +00:00
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
|
import {expect} from "chai";
|
||
|
import sinon from "ts-sinon";
|
||
|
import Auth from "../../../client/js/auth";
|
||
|
import localStorage from "../../../client/js/localStorage";
|
||
|
import location from "../../../client/js/location";
|
||
|
|
||
|
describe("Auth", function () {
|
||
|
describe(".signout", function () {
|
||
|
let localStorageClearStub: sinon.SinonStub<[], void>;
|
||
|
let locationReloadStub: sinon.SinonStub<[], void>;
|
||
|
|
||
|
beforeEach(function () {
|
||
|
localStorageClearStub = sinon.stub(localStorage, "clear");
|
||
|
locationReloadStub = sinon.stub(location, "reload");
|
||
|
});
|
||
|
|
||
|
afterEach(function () {
|
||
|
localStorageClearStub.restore();
|
||
|
locationReloadStub.restore();
|
||
|
});
|
||
|
|
||
|
it("should empty the local storage", function () {
|
||
|
Auth.signout();
|
||
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'calledOnce' does not exist on type '() =... Remove this comment to see the full error message
|
||
|
expect(localStorage.clear.calledOnce).to.be.true;
|
||
|
});
|
||
|
|
||
|
it("should reload the page", function () {
|
||
|
Auth.signout();
|
||
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'calledOnce' does not exist on type '{ ()... Remove this comment to see the full error message
|
||
|
expect(location.reload.calledOnce).to.be.true;
|
||
|
});
|
||
|
});
|
||
|
});
|