Skip to content

Commit

Permalink
fix ready tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jjspace committed Jan 10, 2025
1 parent f01671e commit d785a20
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/engine/Specs/DataSources/DataSourceDisplaySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ describe(
});
});

it("ready is true when datasources are ready", function () {
it("ready is true once datasources are ready and stays true", async function () {
const source1 = new MockDataSource();
const source2 = new MockDataSource();

Expand All @@ -372,19 +372,19 @@ describe(
dataSourceCollection: dataSourceCollection,
visualizersCallback: visualizersCallback,
});
expect(display.ready).toBe(false);
expect(display.ready).withContext("before adding sources").toBe(false);

return Promise.all([
await Promise.all([
dataSourceCollection.add(source1),
dataSourceCollection.add(source2),
]).then(function () {
display.update(Iso8601.MINIMUM_VALUE);
expect(display.ready).toBe(true);
]);

spyOn(MockVisualizer.prototype, "update").and.returnValue(false);
display.update(Iso8601.MINIMUM_VALUE);
expect(display.ready).toBe(false);
});
display.update(Iso8601.MINIMUM_VALUE);
expect(display.ready).withContext("after adding sources").toBe(true);

spyOn(MockVisualizer.prototype, "update").and.returnValue(false);
display.update(Iso8601.MINIMUM_VALUE);
expect(display.ready).withContext("after updating again").toBe(true);
});

it("triggers a rendering when the data source becomes ready", function () {
Expand Down

0 comments on commit d785a20

Please sign in to comment.