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

Commit

Permalink
fix(usePolling): Use cleanDepedenciesCache instead of cleanCache in f…
Browse files Browse the repository at this point in the history
…irst invocation. Fix flaky test (#107)
  • Loading branch information
javierbrea committed Dec 19, 2020
1 parent 92cd4d0 commit 5400c37
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/usePolling.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const pollingProviders = {};

class PollingHandler {
constructor(provider, intervalTime, options) {
provider.cleanCache();
provider.cleanDependenciesCache(options);
this._options = options;
this._provider = provider;
this._id = provider.id;
Expand Down
34 changes: 33 additions & 1 deletion test-e2e/cypress/integration/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,40 @@ describe("Demo page", () => {
it("should not be loading", () => {
authors.shouldNotBeLoading();
});
});

describe("books column", () => {
it("should display 5 results", () => {
books.shouldDisplayItems(5);
});

it("should not be loading", () => {
books.shouldNotBeLoading();
});
});

it("should display 5 results after adding a new book", () => {
describe("authors loaded column", () => {
it("should display 4 results", () => {
authorsLoaded.shouldDisplayItems(4);
});

it("should not be loading", () => {
authorsLoaded.shouldNotBeLoading();
});
});

describe("books loaded column", () => {
it("should display 5 results", () => {
booksLoaded.shouldDisplayItems(5);
});

it("should not be loading", () => {
booksLoaded.shouldNotBeLoading();
});
});

describe("when adding a new book", () => {
it("should display 5 results", () => {
authors.add(NEW_AUTHOR);
authors.shouldBeLoading();
authorsLoaded.shouldNotBeLoading();
Expand Down

0 comments on commit 5400c37

Please sign in to comment.