Skip to content

Commit a56134b

Browse files
author
Greg Soltis
authored
Disable some spec tests on mobile (#1134)
* Disable some spec tests on mobile * [AUTOMATED]: Prettier Code Styling
1 parent 229832f commit a56134b

File tree

2 files changed

+100
-84
lines changed

2 files changed

+100
-84
lines changed

packages/firestore/test/unit/specs/offline_spec.test.ts

+99-83
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,53 @@ import { spec } from './spec_builder';
2323
import { TimerId } from '../../../src/util/async_queue';
2424

2525
describeSpec('Offline:', [], () => {
26-
specTest('Empty queries are resolved if client goes offline', [], () => {
27-
const query = Query.atPath(path('collection'));
28-
return (
29-
spec()
30-
.userListens(query)
31-
.watchStreamCloses(Code.UNAVAILABLE)
32-
.expectEvents(query, {
33-
fromCache: true,
34-
hasPendingWrites: false
35-
})
36-
// no further events
37-
.watchStreamCloses(Code.UNAVAILABLE)
38-
.watchStreamCloses(Code.UNAVAILABLE)
39-
);
40-
});
26+
specTest(
27+
'Empty queries are resolved if client goes offline',
28+
['no-android', 'no-ios'],
29+
() => {
30+
const query = Query.atPath(path('collection'));
31+
return (
32+
spec()
33+
.userListens(query)
34+
.watchStreamCloses(Code.UNAVAILABLE)
35+
.expectEvents(query, {
36+
fromCache: true,
37+
hasPendingWrites: false
38+
})
39+
// no further events
40+
.watchStreamCloses(Code.UNAVAILABLE)
41+
.watchStreamCloses(Code.UNAVAILABLE)
42+
);
43+
}
44+
);
4145

42-
specTest('A successful message delays offline status', [], () => {
43-
const query = Query.atPath(path('collection'));
44-
return (
45-
spec()
46-
.userListens(query)
47-
.watchAcks(query)
48-
// first error triggers unknown state
49-
.watchStreamCloses(Code.UNAVAILABLE)
50-
// second error triggers offline state
51-
.watchStreamCloses(Code.UNAVAILABLE)
52-
.expectEvents(query, {
53-
fromCache: true,
54-
hasPendingWrites: false
55-
})
56-
// no further events
57-
.watchStreamCloses(Code.UNAVAILABLE)
58-
.watchStreamCloses(Code.UNAVAILABLE)
59-
);
60-
});
46+
specTest(
47+
'A successful message delays offline status',
48+
['no-android', 'no-ios'],
49+
() => {
50+
const query = Query.atPath(path('collection'));
51+
return (
52+
spec()
53+
.userListens(query)
54+
.watchAcks(query)
55+
// first error triggers unknown state
56+
.watchStreamCloses(Code.UNAVAILABLE)
57+
// second error triggers offline state
58+
.watchStreamCloses(Code.UNAVAILABLE)
59+
.expectEvents(query, {
60+
fromCache: true,
61+
hasPendingWrites: false
62+
})
63+
// no further events
64+
.watchStreamCloses(Code.UNAVAILABLE)
65+
.watchStreamCloses(Code.UNAVAILABLE)
66+
);
67+
}
68+
);
6169

6270
specTest(
6371
'Removing all listeners delays "Offline" status on next listen',
64-
['eager-gc'],
72+
['eager-gc', 'no-android', 'no-ios'],
6573
'Marked as no-lru because when a listen is re-added, it gets a new target id rather than reusing one',
6674
() => {
6775
const query = Query.atPath(path('collection'));
@@ -91,54 +99,62 @@ describeSpec('Offline:', [], () => {
9199
}
92100
);
93101

94-
specTest('Queries revert to fromCache=true when offline.', [], () => {
95-
const query = Query.atPath(path('collection'));
96-
const docA = doc('collection/a', 1000, { key: 'a' });
97-
return (
98-
spec()
99-
.userListens(query)
100-
.watchAcksFull(query, 1000, docA)
101-
.expectEvents(query, { added: [docA] })
102-
// first error triggers unknown state
103-
.watchStreamCloses(Code.UNAVAILABLE)
104-
.restoreListen(query, 'resume-token-1000')
105-
// second error triggers offline state and fromCache: true
106-
.watchStreamCloses(Code.UNAVAILABLE)
107-
.expectEvents(query, { fromCache: true })
108-
// Going online and getting a CURRENT message triggers fromCache: false
109-
.watchAcksFull(query, 1000)
110-
.expectEvents(query, { fromCache: false })
111-
);
112-
});
102+
specTest(
103+
'Queries revert to fromCache=true when offline.',
104+
['no-android', 'no-ios'],
105+
() => {
106+
const query = Query.atPath(path('collection'));
107+
const docA = doc('collection/a', 1000, { key: 'a' });
108+
return (
109+
spec()
110+
.userListens(query)
111+
.watchAcksFull(query, 1000, docA)
112+
.expectEvents(query, { added: [docA] })
113+
// first error triggers unknown state
114+
.watchStreamCloses(Code.UNAVAILABLE)
115+
.restoreListen(query, 'resume-token-1000')
116+
// second error triggers offline state and fromCache: true
117+
.watchStreamCloses(Code.UNAVAILABLE)
118+
.expectEvents(query, { fromCache: true })
119+
// Going online and getting a CURRENT message triggers fromCache: false
120+
.watchAcksFull(query, 1000)
121+
.expectEvents(query, { fromCache: false })
122+
);
123+
}
124+
);
113125

114-
specTest('Queries with limbo documents handle going offline.', [], () => {
115-
const query = Query.atPath(path('collection'));
116-
const docA = doc('collection/a', 1000, { key: 'a' });
117-
const limboQuery = Query.atPath(docA.key.path);
118-
return (
119-
spec()
120-
.userListens(query)
121-
.watchAcksFull(query, 1000, docA)
122-
.expectEvents(query, { added: [docA] })
123-
.watchResets(query)
124-
// No more documents
125-
.watchCurrents(query, 'resume-token-1001')
126-
.watchSnapshots(1001)
127-
// docA will now be in limbo (triggering fromCache=true)
128-
.expectLimboDocs(docA.key)
129-
.expectEvents(query, { fromCache: true })
130-
// first error triggers unknown state
131-
.watchStreamCloses(Code.UNAVAILABLE)
132-
.restoreListen(query, 'resume-token-1001')
133-
// second error triggers offline state.
134-
.watchStreamCloses(Code.UNAVAILABLE)
135-
.watchAcksFull(query, 1001)
136-
.watchAcksFull(limboQuery, 1001)
137-
// Limbo document is resolved. No longer from cache.
138-
.expectEvents(query, { removed: [docA], fromCache: false })
139-
.expectLimboDocs()
140-
);
141-
});
126+
specTest(
127+
'Queries with limbo documents handle going offline.',
128+
['no-android', 'no-ios'],
129+
() => {
130+
const query = Query.atPath(path('collection'));
131+
const docA = doc('collection/a', 1000, { key: 'a' });
132+
const limboQuery = Query.atPath(docA.key.path);
133+
return (
134+
spec()
135+
.userListens(query)
136+
.watchAcksFull(query, 1000, docA)
137+
.expectEvents(query, { added: [docA] })
138+
.watchResets(query)
139+
// No more documents
140+
.watchCurrents(query, 'resume-token-1001')
141+
.watchSnapshots(1001)
142+
// docA will now be in limbo (triggering fromCache=true)
143+
.expectLimboDocs(docA.key)
144+
.expectEvents(query, { fromCache: true })
145+
// first error triggers unknown state
146+
.watchStreamCloses(Code.UNAVAILABLE)
147+
.restoreListen(query, 'resume-token-1001')
148+
// second error triggers offline state.
149+
.watchStreamCloses(Code.UNAVAILABLE)
150+
.watchAcksFull(query, 1001)
151+
.watchAcksFull(limboQuery, 1001)
152+
// Limbo document is resolved. No longer from cache.
153+
.expectEvents(query, { removed: [docA], fromCache: false })
154+
.expectLimboDocs()
155+
);
156+
}
157+
);
142158

143159
specTest('OnlineState timeout triggers offline behavior', [], () => {
144160
const query = Query.atPath(path('collection'));
@@ -177,7 +193,7 @@ describeSpec('Offline:', [], () => {
177193
specTest(
178194
'New queries return immediately with fromCache=true when offline due to ' +
179195
'stream failures.',
180-
[],
196+
['no-android', 'no-ios'],
181197
() => {
182198
const query1 = Query.atPath(path('collection'));
183199
const query2 = Query.atPath(path('collection2'));

packages/firestore/test/unit/specs/remote_store_spec.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describeSpec('Remote store:', [], () => {
6767
.expectEvents(query, { added: [doc4] }); // This should work now.
6868
});
6969

70-
specTest('Cleans up watch state correctly', [], () => {
70+
specTest('Cleans up watch state correctly', ['no-android', 'no-ios'], () => {
7171
const query = Query.atPath(path('collection'));
7272
const doc1 = doc('collection/a', 1000, { key: 'a' });
7373
return (

0 commit comments

Comments
 (0)