Skip to content

Commit 2b53ff4

Browse files
committed
Enforce mock settings by default for ratings panel tests
1 parent 378e6e6 commit 2b53ff4

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

src/tests/clipperUI/panels/ratingsPanel_tests.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Clipper.getCachedValue = (key: string) => {
4646
QUnit.module("ratingsPanel", {
4747
beforeEach: () => {
4848
Clipper.logger = new StubSessionLogger();
49-
Settings.setSettingsJsonForTesting();
49+
Settings.setSettingsJsonForTesting({});
5050

5151
mockStorage = {};
5252
mockStorageCache = {};
@@ -95,8 +95,6 @@ test("'Positive' click at RatingsPromptStage.Init goes to RatingsPromptStage.Rat
9595
test("'Positive' click at RatingsPromptStage.Init goes to RatingsPromptStage.End when rate url does not exist", (assert: QUnitAssert) => {
9696
let done = assert.async();
9797

98-
Settings.setSettingsJsonForTesting({});
99-
10098
let clipperState = HelperFunctions.getMockClipperState();
10199
clipperState.showRatingsPrompt = new SmartValue<boolean>(true);
102100

@@ -151,8 +149,6 @@ test("'Negative' click at RatingsPromptStage.Init without a prior bad rating goe
151149
test("'Negative' click at RatingsPromptStage.Init without a prior bad rating goes to RatingsPromptStage.End when feedback url does not exist (and doNotPromptRatings === undefined)", (assert: QUnitAssert) => {
152150
let done = assert.async();
153151

154-
Settings.setSettingsJsonForTesting({});
155-
156152
Clipper.storeValue(ClipperStorageKeys.lastSeenVersion, "3.1.0");
157153

158154
let clipperState = HelperFunctions.getMockClipperState();
@@ -210,8 +206,6 @@ test("'Negative' click at RatingsPromptStage.Init with a prior bad rating sets d
210206
test("'Negative' click at RatingsPromptStage.Init with a prior bad rating sets doNotPromptRatings to 'true' (feedback url does not exist)", (assert: QUnitAssert) => {
211207
let done = assert.async();
212208

213-
Settings.setSettingsJsonForTesting({});
214-
215209
Clipper.storeValue(ClipperStorageKeys.lastBadRatingDate, (Date.now() - Constants.Settings.minTimeBetweenBadRatings).toString());
216210
Clipper.storeValue(ClipperStorageKeys.lastSeenVersion, "3.1.0");
217211

@@ -262,8 +256,6 @@ test("'Rate' click at RatingsPromptStage.Rate goes to RatingsPromptStage.End whe
262256
});
263257

264258
test("'Rate' click at RatingsPromptStage.Rate not available when rate url does not exist (unexpected scenario)", () => {
265-
Settings.setSettingsJsonForTesting({});
266-
267259
let clipperState = HelperFunctions.getMockClipperState();
268260
clipperState.showRatingsPrompt = new SmartValue<boolean>(true);
269261

@@ -308,8 +300,6 @@ test("'No Thanks' click at RatingsPromptStage.Rate goes to RatingsPromptStage.No
308300
});
309301

310302
test("'No Thanks' click at RatingsPromptStage.Rate not available when rate url does not exist (unexpected scenario)", () => {
311-
Settings.setSettingsJsonForTesting({});
312-
313303
let clipperState = HelperFunctions.getMockClipperState();
314304
clipperState.showRatingsPrompt = new SmartValue<boolean>(true);
315305

@@ -356,8 +346,6 @@ test("'Feedback' click at RatingsPromptStage.Feedback goes to RatingsPromptStage
356346
});
357347

358348
test("'Feedback' click at RatingsPromptStage.Feedback not available when feedback url does not exist (unexpected scenario)", () => {
359-
Settings.setSettingsJsonForTesting({});
360-
361349
Clipper.storeValue(ClipperStorageKeys.lastSeenVersion, "3.1.0");
362350

363351
let clipperState = HelperFunctions.getMockClipperState();
@@ -406,8 +394,6 @@ test("'No Thanks' click at RatingsPromptStage.Feedback goes to RatingsPromptStag
406394
});
407395

408396
test("'No Thanks' click at RatingsPromptStage.Feedback not available when feedback url does not exist (unexpected scenario)", () => {
409-
Settings.setSettingsJsonForTesting({});
410-
411397
Clipper.storeValue(ClipperStorageKeys.lastSeenVersion, "3.1.0");
412398

413399
let clipperState = HelperFunctions.getMockClipperState();

src/tests/clipperUI/ratingsHelper_tests.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Clipper.getCachedValue = (key: string) => {
4444
QUnit.module("ratingsHelper", {
4545
beforeEach: () => {
4646
Clipper.logger = new StubSessionLogger();
47-
Settings.setSettingsJsonForTesting();
47+
Settings.setSettingsJsonForTesting({});
4848

4949
mockStorage = {};
5050
mockStorageCache = {};
@@ -178,8 +178,6 @@ test("badRatingTimingDelayIsOver returns true when the time between bad rating a
178178
// getFeedbackUrlIfExists
179179

180180
test("getFeedbackUrlIfExists returns undefined if log category for ratings prompt does not exist", () => {
181-
Settings.setSettingsJsonForTesting({});
182-
183181
let url: string = RatingsHelper.getFeedbackUrlIfExists({});
184182
strictEqual(url, undefined, "setting for log category for ratings prompt does not exist");
185183

@@ -237,8 +235,6 @@ test("getRateUrlIfExists returns undefined if ClientType/ClipperType is invalid"
237235
});
238236

239237
test("getRateUrlIfExists returns undefined if a client's rate url does not exist", () => {
240-
Settings.setSettingsJsonForTesting({});
241-
242238
let clientType: ClientType = ClientType.ChromeExtension;
243239
let settingName: string = ClientType[clientType] + RatingsHelper.rateUrlSettingNameSuffix;
244240

@@ -291,8 +287,6 @@ test("ratingsPromptEnabledForClient returns false if ClientType/ClipperType is i
291287
});
292288

293289
test("ratingsPromptEnabledForClient returns false if a client's enable value does not exist", () => {
294-
Settings.setSettingsJsonForTesting({});
295-
296290
let clientType: ClientType = ClientType.ChromeExtension;
297291
let settingName: string = ClientType[clientType] + RatingsHelper.ratingsPromptEnabledSettingNameSuffix;
298292

0 commit comments

Comments
 (0)