@@ -23,45 +23,53 @@ import { spec } from './spec_builder';
23
23
import { TimerId } from '../../../src/util/async_queue' ;
24
24
25
25
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
+ ) ;
41
45
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
+ ) ;
61
69
62
70
specTest (
63
71
'Removing all listeners delays "Offline" status on next listen' ,
64
- [ 'eager-gc' ] ,
72
+ [ 'eager-gc' , 'no-android' , 'no-ios' ] ,
65
73
'Marked as no-lru because when a listen is re-added, it gets a new target id rather than reusing one' ,
66
74
( ) => {
67
75
const query = Query . atPath ( path ( 'collection' ) ) ;
@@ -91,54 +99,62 @@ describeSpec('Offline:', [], () => {
91
99
}
92
100
) ;
93
101
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
+ ) ;
113
125
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
+ ) ;
142
158
143
159
specTest ( 'OnlineState timeout triggers offline behavior' , [ ] , ( ) => {
144
160
const query = Query . atPath ( path ( 'collection' ) ) ;
@@ -177,7 +193,7 @@ describeSpec('Offline:', [], () => {
177
193
specTest (
178
194
'New queries return immediately with fromCache=true when offline due to ' +
179
195
'stream failures.' ,
180
- [ ] ,
196
+ [ 'no-android' , 'no-ios' ] ,
181
197
( ) => {
182
198
const query1 = Query . atPath ( path ( 'collection' ) ) ;
183
199
const query2 = Query . atPath ( path ( 'collection2' ) ) ;
0 commit comments