Skip to content

Commit 9b2b995

Browse files
author
Shahak Yosef
committed
Merged PR 110213: Fix JS SDK tests
Fix JS SDK tests
1 parent 6754d96 commit 9b2b995

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/test.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,8 @@ describe('SDK-to-HPM', function () {
27292729
return <Router.Router><any>spyRouter;
27302730
};
27312731

2732+
spyOn(utils, "getTimeDiffInMilliseconds").and.callFake(() => 700); // Prevent requests from being throttled.
2733+
27322734
powerbi = new service.Service(spyHpmFactory, noop, spyRouterFactory, { wpmpName: 'SDK-to-HPM report wpmp' });
27332735

27342736
$reportElement = $(`<div class="powerbi-report-container"></div>`)
@@ -2822,9 +2824,6 @@ describe('SDK-to-HPM', function () {
28222824
});
28232825

28242826
describe('report', function () {
2825-
beforeEach(() => {
2826-
report.lastLoadRequest = new Date(2018, 1, 1);
2827-
});
28282827

28292828
describe('load', function () {
28302829
it('report.load() sends POST /report/load with configuration in body', function () {
@@ -3575,7 +3574,6 @@ describe('SDK-to-HPM', function () {
35753574
report.load()
35763575
.then(() => {
35773576
spyHpm.post.calls.reset();
3578-
report.lastLoadRequest = new Date(2018, 1, 1);
35793577

35803578
// Act
35813579
report.reload();
@@ -3771,7 +3769,6 @@ describe('SDK-to-HPM', function () {
37713769
// Act
37723770
let expectedConfiguration = utils.assign({}, dashboard.config, testData.loadConfiguration);
37733771
dashboard.config = expectedConfiguration;
3774-
dashboard.lastLoadRequest = new Date(2018, 1, 1);
37753772
dashboard.load();
37763773

37773774
const expectedHeaders = {
@@ -4507,6 +4504,11 @@ describe('SDK-to-MockApp', function () {
45074504
});
45084505

45094506
describe('report', function () {
4507+
4508+
beforeEach(function () {
4509+
spyOn(utils, "getTimeDiffInMilliseconds").and.callFake(() => 700); // Prevent requests from being throttled.
4510+
});
4511+
45104512
describe('load', function () {
45114513
it(`report.load() returns promise that rejects with validation errors if load configuration is invalid`, function (done) {
45124514
// Arrange
@@ -4528,7 +4530,6 @@ describe('SDK-to-MockApp', function () {
45284530
// Act
45294531
let expectedConfiguration = utils.assign({}, report.config, testData.loadConfig);
45304532
report.config = expectedConfiguration;
4531-
report.lastLoadRequest = new Date(2018, 1, 1);
45324533
report.load()
45334534
.catch(errors => {
45344535
// Assert
@@ -4556,7 +4557,6 @@ describe('SDK-to-MockApp', function () {
45564557
// Act
45574558
let expectedConfiguration = utils.assign({}, report.config, testData.loadConfig);
45584559
report.config = expectedConfiguration;
4559-
report.lastLoadRequest = new Date(2018, 1, 1);
45604560
report.load()
45614561
.then(response => {
45624562
// Assert

0 commit comments

Comments
 (0)