2018-03-20 04:52:58 +00:00
|
|
|
"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;
|
2018-03-20 04:52:58 +00:00
|
|
|
|
2020-03-21 20:55:36 +00:00
|
|
|
describe("Auth", function () {
|
|
|
|
describe(".signout", function () {
|
|
|
|
beforeEach(function () {
|
2018-03-20 04:52:58 +00:00
|
|
|
stub(localStorage, "clear");
|
|
|
|
stub(location, "reload");
|
|
|
|
});
|
|
|
|
|
2020-03-21 20:55:36 +00:00
|
|
|
afterEach(function () {
|
2018-03-20 04:52:58 +00:00
|
|
|
localStorage.clear.restore();
|
|
|
|
location.reload.restore();
|
|
|
|
});
|
|
|
|
|
2020-03-21 20:55:36 +00:00
|
|
|
it("should empty the local storage", function () {
|
2018-03-20 04:52:58 +00:00
|
|
|
Auth.signout();
|
|
|
|
expect(localStorage.clear.calledOnce).to.be.true;
|
|
|
|
});
|
|
|
|
|
2020-03-21 20:55:36 +00:00
|
|
|
it("should reload the page", function () {
|
2018-03-20 04:52:58 +00:00
|
|
|
Auth.signout();
|
|
|
|
expect(location.reload.calledOnce).to.be.true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|