Skip to content

Commit ad98df0

Browse files
authored
tests/integration: move isSafari checks to testUtils.isSafari() (#8756)
* avoid repeating complicated test * consistent with `testUtils.isIE()`
1 parent 197fcc4 commit ad98df0

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

tests/integration/test.attachments.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3101,10 +3101,7 @@ adapters.forEach(function (adapter) {
31013101
});
31023102

31033103

3104-
var isSafari = (typeof process === 'undefined' || process.browser) &&
3105-
/Safari/.test(window.navigator.userAgent) &&
3106-
!/Chrome/.test(window.navigator.userAgent);
3107-
if (!isSafari && !testUtils.isIE()) {
3104+
if (!testUtils.isSafari() && !testUtils.isIE()) {
31083105
// skip in safari/ios because of size limit popup
31093106
it('putAttachment and getAttachment with big png data', function (done) {
31103107

tests/integration/test.bulk_docs.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,9 +1012,7 @@ adapters.forEach(function (adapter) {
10121012

10131013
// simulate 5000 normal commits with two conflicts at the very end
10141014

1015-
var isSafari = (typeof process === 'undefined' || process.browser) &&
1016-
/Safari/.test(window.navigator.userAgent) &&
1017-
!/Chrome/.test(window.navigator.userAgent);
1015+
const isSafari = testUtils.isSafari();
10181016

10191017
var numRevs = isSafari ? 10 : 5000;
10201018
var expected = isSafari ? 10 : 1000;

tests/integration/test.replication.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,7 @@ adapters.forEach(function (adapters) {
171171
}
172172

173173
var numRevs = 5000;
174-
var isSafari = (typeof process === 'undefined' || process.browser) &&
175-
/Safari/.test(window.navigator.userAgent) &&
176-
!/Chrome/.test(window.navigator.userAgent);
177-
if (isSafari) {
174+
if (testUtils.isSafari()) {
178175
numRevs = 10; // fuck safari, we've hit the storage limit again
179176
}
180177

tests/integration/utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ testUtils.isIE = function () {
2424
return (isIE || isTrident || isEdge);
2525
};
2626

27+
testUtils.isSafari = function () {
28+
return (typeof process === 'undefined' || process.browser) &&
29+
/Safari/.test(window.navigator.userAgent) &&
30+
!/Chrome/.test(window.navigator.userAgent);
31+
};
32+
2733
testUtils.adapterType = function () {
2834
return testUtils.adapters().indexOf('http') < 0 ? 'local' : 'http';
2935
};

0 commit comments

Comments
 (0)