mirror of
https://github.com/thelounge/thelounge
synced 2024-11-22 12:03:11 +00:00
dd05ee3a65
Co-authored-by: Eric Nemchik <eric@nemchik.com> Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
34 lines
1.2 KiB
TypeScript
34 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;
|
|
});
|
|
});
|
|
});
|