diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-12-22 10:28:14 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-12-22 10:48:39 +0900 |
commit | 029d5365e7d74e87375fccb8db097b7c2df3f7f4 (patch) | |
tree | 6a24c719da9c60461c7e2fe120b0d42af9e580f2 /test/background | |
parent | d72012529bcd820598fa64e1aa20dab1c16acaa5 (diff) |
npm run lint:fix
Diffstat (limited to 'test/background')
-rw-r--r-- | test/background/infrastructures/MemoryStorage.test.ts | 14 | ||||
-rw-r--r-- | test/background/repositories/Mark.test.ts | 2 | ||||
-rw-r--r-- | test/background/usecases/NavigateUseCase.test.ts | 20 | ||||
-rw-r--r-- | test/background/usecases/filters.test.ts | 32 | ||||
-rw-r--r-- | test/background/usecases/parsers.test.ts | 4 |
5 files changed, 36 insertions, 36 deletions
diff --git a/test/background/infrastructures/MemoryStorage.test.ts b/test/background/infrastructures/MemoryStorage.test.ts index 95d3780..ccdf9f0 100644 --- a/test/background/infrastructures/MemoryStorage.test.ts +++ b/test/background/infrastructures/MemoryStorage.test.ts @@ -2,7 +2,7 @@ import MemoryStorage from 'background/infrastructures/MemoryStorage'; describe("background/infrastructures/memory-storage", () => { it('stores values', () => { - let cache = new MemoryStorage(); + const cache = new MemoryStorage(); cache.set('number', 123); expect(cache.get('number')).to.equal(123); @@ -14,7 +14,7 @@ describe("background/infrastructures/memory-storage", () => { }); it('returns undefined if no keys', () => { - let cache = new MemoryStorage(); + const cache = new MemoryStorage(); expect(cache.get('no-keys')).to.be.undefined; }) @@ -23,22 +23,22 @@ describe("background/infrastructures/memory-storage", () => { cache.set('red', 'apple'); cache = new MemoryStorage(); - let got = cache.get('red'); + const got = cache.get('red'); expect(got).to.equal('apple'); }); it('stored cloned objects', () => { - let cache = new MemoryStorage(); - let recipe = { sugar: '300g' }; + const cache = new MemoryStorage(); + const recipe = { sugar: '300g' }; cache.set('recipe', recipe); recipe.salt = '20g' - let got = cache.get('recipe', recipe); + const got = cache.get('recipe', recipe); expect(got).to.deep.equal({ sugar: '300g' }); }); it('throws an error with unserializable objects', () => { - let cache = new MemoryStorage(); + const cache = new MemoryStorage(); expect(() => cache.set('fn', setTimeout)).to.throw(); }) }); diff --git a/test/background/repositories/Mark.test.ts b/test/background/repositories/Mark.test.ts index 167e512..625f11d 100644 --- a/test/background/repositories/Mark.test.ts +++ b/test/background/repositories/Mark.test.ts @@ -9,7 +9,7 @@ describe('background/repositories/mark', () => { }); it('get and set', async() => { - let mark = { tabId: 1, url: 'http://example.com', x: 10, y: 30 }; + const mark = { tabId: 1, url: 'http://example.com', x: 10, y: 30 }; repository.setMark('A', mark); diff --git a/test/background/usecases/NavigateUseCase.test.ts b/test/background/usecases/NavigateUseCase.test.ts index ecbf888..48a1c5b 100644 --- a/test/background/usecases/NavigateUseCase.test.ts +++ b/test/background/usecases/NavigateUseCase.test.ts @@ -16,10 +16,10 @@ describe('NavigateUseCase', () => { describe('#openParent()', async () => { it('opens parent directory of file', async() => { - var stub = sinon.stub(tabPresenter, 'getCurrent'); + const stub = sinon.stub(tabPresenter, 'getCurrent'); stub.returns(Promise.resolve({ url: 'https://google.com/fruits/yellow/banana' })) - var mock = sinon.mock(tabPresenter); + const mock = sinon.mock(tabPresenter); mock.expects('open').withArgs('https://google.com/fruits/yellow/'); await sut.openParent(); @@ -28,10 +28,10 @@ describe('NavigateUseCase', () => { }); it('opens parent directory of directory', async() => { - var stub = sinon.stub(tabPresenter, 'getCurrent'); + const stub = sinon.stub(tabPresenter, 'getCurrent'); stub.returns(Promise.resolve({ url: 'https://google.com/fruits/yellow/' })) - var mock = sinon.mock(tabPresenter); + const mock = sinon.mock(tabPresenter); mock.expects('open').withArgs('https://google.com/fruits/'); await sut.openParent(); @@ -40,10 +40,10 @@ describe('NavigateUseCase', () => { }); it('removes hash', async() => { - var stub = sinon.stub(tabPresenter, 'getCurrent'); + const stub = sinon.stub(tabPresenter, 'getCurrent'); stub.returns(Promise.resolve({ url: 'https://google.com/#top' })) - var mock = sinon.mock(tabPresenter); + const mock = sinon.mock(tabPresenter); mock.expects('open').withArgs('https://google.com/'); await sut.openParent(); @@ -52,10 +52,10 @@ describe('NavigateUseCase', () => { }); it('removes search query', async() => { - var stub = sinon.stub(tabPresenter, 'getCurrent'); + const stub = sinon.stub(tabPresenter, 'getCurrent'); stub.returns(Promise.resolve({ url: 'https://google.com/search?q=apple' })) - var mock = sinon.mock(tabPresenter); + const mock = sinon.mock(tabPresenter); mock.expects('open').withArgs('https://google.com/search'); await sut.openParent(); @@ -66,12 +66,12 @@ describe('NavigateUseCase', () => { describe('#openRoot()', () => { it('opens root direectory', async() => { - var stub = sinon.stub(tabPresenter, 'getCurrent'); + const stub = sinon.stub(tabPresenter, 'getCurrent'); stub.returns(Promise.resolve({ url: 'https://google.com/seach?q=apple', })) - var mock = sinon.mock(tabPresenter); + const mock = sinon.mock(tabPresenter); mock.expects('open').withArgs('https://google.com'); await sut.openRoot(); diff --git a/test/background/usecases/filters.test.ts b/test/background/usecases/filters.test.ts index bdfb0be..90541ff 100644 --- a/test/background/usecases/filters.test.ts +++ b/test/background/usecases/filters.test.ts @@ -3,15 +3,15 @@ import * as filters from 'background/usecases/filters'; describe("background/usecases/filters", () => { describe('filterHttp', () => { it('filters http URLs duplicates to https hosts', () => { - let pages = [ + const pages = [ { url: 'http://i-beam.org/foo' }, { url: 'https://i-beam.org/bar' }, { url: 'http://i-beam.net/hoge' }, { url: 'http://i-beam.net/fuga' }, ]; - let filtered = filters.filterHttp(pages); + const filtered = filters.filterHttp(pages); - let urls = filtered.map(x => x.url); + const urls = filtered.map(x => x.url); expect(urls).to.deep.equal([ 'https://i-beam.org/bar', 'http://i-beam.net/hoge', 'http://i-beam.net/fuga' ]); @@ -20,12 +20,12 @@ describe("background/usecases/filters", () => { describe('filterBlankTitle', () => { it('filters blank titles', () => { - let pages = [ + const pages = [ { title: 'hello' }, { title: '' }, {}, ]; - let filtered = filters.filterBlankTitle(pages); + const filtered = filters.filterBlankTitle(pages); expect(filtered).to.deep.equal([{ title: 'hello' }]); }); @@ -33,15 +33,15 @@ describe("background/usecases/filters", () => { describe('filterByTailingSlash', () => { it('filters duplicated pathname on tailing slash', () => { - let pages = [ + const pages = [ { url: 'http://i-beam.org/content' }, { url: 'http://i-beam.org/content/' }, { url: 'http://i-beam.org/search' }, { url: 'http://i-beam.org/search?q=apple_banana_cherry' }, ]; - let filtered = filters.filterByTailingSlash(pages); + const filtered = filters.filterByTailingSlash(pages); - let urls = filtered.map(x => x.url); + const urls = filtered.map(x => x.url); expect(urls).to.deep.equal([ 'http://i-beam.org/content', 'http://i-beam.org/search', @@ -52,7 +52,7 @@ describe("background/usecases/filters", () => { describe('filterByPathname', () => { it('remains items less than minimam length', () => { - let pages = [ + const pages = [ { url: 'http://i-beam.org/search?q=apple' }, { url: 'http://i-beam.org/search?q=apple_banana' }, { url: 'http://i-beam.org/search?q=apple_banana_cherry' }, @@ -60,12 +60,12 @@ describe("background/usecases/filters", () => { { url: 'http://i-beam.org/request?q=apple_banana' }, { url: 'http://i-beam.org/request?q=apple_banana_cherry' }, ]; - let filtered = filters.filterByPathname(pages, 10); + const filtered = filters.filterByPathname(pages, 10); expect(filtered).to.have.lengthOf(6); }); it('filters by length of pathname', () => { - let pages = [ + const pages = [ { url: 'http://i-beam.org/search?q=apple' }, { url: 'http://i-beam.org/search?q=apple_banana' }, { url: 'http://i-beam.org/search?q=apple_banana_cherry' }, @@ -73,7 +73,7 @@ describe("background/usecases/filters", () => { { url: 'http://i-beam.net/search?q=apple_banana' }, { url: 'http://i-beam.net/search?q=apple_banana_cherry' }, ]; - let filtered = filters.filterByPathname(pages, 0); + const filtered = filters.filterByPathname(pages, 0); expect(filtered).to.deep.equal([ { url: 'http://i-beam.org/search?q=apple' }, { url: 'http://i-beam.net/search?q=apple' }, @@ -83,7 +83,7 @@ describe("background/usecases/filters", () => { describe('filterByOrigin', () => { it('remains items less than minimam length', () => { - let pages = [ + const pages = [ { url: 'http://i-beam.org/search?q=apple' }, { url: 'http://i-beam.org/search?q=apple_banana' }, { url: 'http://i-beam.org/search?q=apple_banana_cherry' }, @@ -91,12 +91,12 @@ describe("background/usecases/filters", () => { { url: 'http://i-beam.org/request?q=apple_banana' }, { url: 'http://i-beam.org/request?q=apple_banana_cherry' }, ]; - let filtered = filters.filterByOrigin(pages, 10); + const filtered = filters.filterByOrigin(pages, 10); expect(filtered).to.have.lengthOf(6); }); it('filters by length of pathname', () => { - let pages = [ + const pages = [ { url: 'http://i-beam.org/search?q=apple' }, { url: 'http://i-beam.org/search?q=apple_banana' }, { url: 'http://i-beam.org/search?q=apple_banana_cherry' }, @@ -104,7 +104,7 @@ describe("background/usecases/filters", () => { { url: 'http://i-beam.org/request?q=apple_banana' }, { url: 'http://i-beam.org/request?q=apple_banana_cherry' }, ]; - let filtered = filters.filterByOrigin(pages, 0); + const filtered = filters.filterByOrigin(pages, 0); expect(filtered).to.deep.equal([ { url: 'http://i-beam.org/search?q=apple' }, ]); diff --git a/test/background/usecases/parsers.test.ts b/test/background/usecases/parsers.test.ts index f3a64eb..d08de0d 100644 --- a/test/background/usecases/parsers.test.ts +++ b/test/background/usecases/parsers.test.ts @@ -3,13 +3,13 @@ import * as parsers from 'background/usecases/parsers'; describe("shared/commands/parsers", () => { describe("#parsers.parseSetOption", () => { it('parse set string', () => { - let [key, value] = parsers.parseSetOption('hintchars=abcdefgh'); + const [key, value] = parsers.parseSetOption('hintchars=abcdefgh'); expect(key).to.equal('hintchars'); expect(value).to.equal('abcdefgh'); }); it('parse set empty string', () => { - let [key, value] = parsers.parseSetOption('hintchars='); + const [key, value] = parsers.parseSetOption('hintchars='); expect(key).to.equal('hintchars'); expect(value).to.equal(''); }); |