hardlounge/test/client/js/authTest.js

32 lines
805 B
JavaScript
Raw Normal View History

"use strict";
const expect = require("chai").expect;
const stub = require("sinon").stub;
2019-11-21 09:11:06 +00:00
const Auth = require("../../../client/js/auth").default;
const localStorage = require("../../../client/js/localStorage").default;
const location = require("../../../client/js/location").default;
describe("Auth", function () {
describe(".signout", function () {
beforeEach(function () {
stub(localStorage, "clear");
stub(location, "reload");
});
afterEach(function () {
localStorage.clear.restore();
location.reload.restore();
});
it("should empty the local storage", function () {
Auth.signout();
expect(localStorage.clear.calledOnce).to.be.true;
});
it("should reload the page", function () {
Auth.signout();
expect(location.reload.calledOnce).to.be.true;
});
});
});