Skip to content

Commit

Permalink
fix spec
Browse files Browse the repository at this point in the history
  • Loading branch information
hashijun committed Aug 30, 2018
1 parent c27abc2 commit afb6712
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/zendesk-incident-protector.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const defaultDOM = new JSDOM(`
</div>
</div>
</footer>
`);
`,
{ url: "http://localhost" });

// mock URL class
class URL {
Expand Down Expand Up @@ -156,8 +157,8 @@ describe('NGWordManager', () => {
});

afterEach(() => {
window.localStorage.clear();
window.localStorage.itemInsertionCallback = null;
global.localStorage.clear();
global.localStorage.itemInsertionCallback = null;
});

describe('#isConfigURLEmpty', () => {
Expand All @@ -168,7 +169,7 @@ describe('NGWordManager', () => {
});
context('localStorage exists', () => {
before(() => {
window.localStorage.setItem(localStorageKey, configURL);
global.localStorage.setItem(localStorageKey, configURL);
});

it('should return false', () => {
Expand All @@ -181,14 +182,14 @@ describe('NGWordManager', () => {
context('arg is URL', () => {
it('should set arg to localStorage', () => {
ngWordManager.configURL = configURL;
window.localStorage.getItem(localStorageKey).should.equal(configURL);
should.equal(ngWordManager.configURL, configURL);
});
});

context('arg is not URL', () => {
it('does not set localStorage', () => {
ngWordManager.configURL = 'not url';
should.equal(window.localStorage.getItem(localStorageKey), null);
should.equal(ngWordManager.configURL, null);
});
});
});
Expand Down

0 comments on commit afb6712

Please sign in to comment.