Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

Commit

Permalink
Cleanup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchoz49 committed May 20, 2020
1 parent 98f313a commit 0d07793
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/feed-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,14 @@ export class FeedStore extends NanoresourcePromise {
}

async _isOpen () {
if (!this.opening && !this.opened) {
if ((!this.opening && !this.opened) || this.closing || this.closed) {
throw new Error('FeedStore closed');
}

if (this.opened) {
return;
}

// If is opening we wait to be ready.
return this.ready();
}
Expand Down
4 changes: 3 additions & 1 deletion src/feed-store.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,13 @@ describe('FeedStore', () => {
await defaultFeeds(feedStore);

expect(feedStore.opened).toBe(true);
expect(feedStore.closed).toBe(false);
expect(feedStore.getDescriptors().filter(fd => fd.opened).length).toBe(3);

await feedStore.close();
expect(feedStore.getDescriptors().filter(fd => fd.opened).length).toBe(0);
expect(feedStore.opened).toBe(false);
expect(feedStore.opened).toBe(true);
expect(feedStore.closed).toBe(true);
});

test('Reopen feedStore and recreate feeds from the indexDB', async () => {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1921,9 +1921,9 @@ ecc-jsbn@~0.1.1:
safer-buffer "^2.1.0"

electron-to-chromium@^1.3.413:
version "1.3.445"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.445.tgz#ce2a2989864d233eeb80437b13069dbca900cd00"
integrity sha512-utucmBYnRyjO3GCsgn7vwTJyDWIyftZW5vuGoxHj2Mnt6yF/alOq1ZGqBGNVZs/vKvgfNZu56y5xpn37i3n0ew==
version "1.3.446"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.446.tgz#12c336bc858e04d6b614a488f32f2dd89561601f"
integrity sha512-CLQaFuvkKqR9FD2G3cJrr1fV7DRMXiAKWLP2F8cxtvvtzAS7Tubt0kF47/m+uE61kiT+I7ZEn7HqLnmWdOhmuA==

emoji-regex@^7.0.1:
version "7.0.3"
Expand Down Expand Up @@ -3971,7 +3971,7 @@ nanoresource-promise@^2.0.0-beta.0:

"nanoresource@git+https://github.com/tinchoz49/nanoresource.git#tinchoz49/refactor-added-reopen-feature":
version "1.3.0"
resolved "git+https://github.com/tinchoz49/nanoresource.git#d6716661d5b4f9a00315ce9e0dc1219fc970eb10"
resolved "git+https://github.com/tinchoz49/nanoresource.git#e3b3f2e577fdbdc04a218014066c28ea90ac81da"
dependencies:
inherits "^2.0.4"

Expand Down

0 comments on commit 0d07793

Please sign in to comment.