@@ -22,16 +22,17 @@ import {
22
22
createOrUpgradeDb ,
23
23
DbMutationBatch ,
24
24
DbMutationBatchKey ,
25
- < << << << HEAD
26
25
DbOwner ,
27
26
DbOwnerKey ,
28
27
DbTarget ,
29
28
DbTargetGlobal ,
30
29
DbTargetGlobalKey ,
30
+ DbTargetKey ,
31
+ DbTimestamp ,
31
32
SCHEMA_VERSION ,
32
33
V1_STORES ,
33
- V2_STORES ,
34
- V3_STORES
34
+ V3_STORES ,
35
+ V4_STORES
35
36
} from '../../../src/local/indexeddb_schema' ;
36
37
import { SimpleDb , SimpleDbTransaction } from '../../../src/local/simple_db' ;
37
38
import { PersistencePromise } from '../../../src/local/persistence_promise' ;
@@ -41,16 +42,7 @@ import { JsonProtoSerializer } from '../../../src/remote/serializer';
41
42
import { PlatformSupport } from '../../../src/platform/platform' ;
42
43
import { AsyncQueue } from '../../../src/util/async_queue' ;
43
44
import { SharedFakeWebStorage , TestPlatform } from '../../util/test_platform' ;
44
- = === ===
45
- DbTarget ,
46
- DbTargetGlobal ,
47
- DbTargetGlobalKey ,
48
- DbTargetKey ,
49
- DbTimestamp
50
- } from '../../../src/local/indexeddb_schema' ;
51
- import { SimpleDb , SimpleDbTransaction } from '../../../src/local/simple_db' ;
52
45
import { SnapshotVersion } from '../../../src/core/snapshot_version' ;
53
- > >>> >>> master
54
46
55
47
const INDEXEDDB_TEST_DATABASE_PREFIX = 'schemaTest/' ;
56
48
const INDEXEDDB_TEST_DATABASE =
@@ -144,31 +136,6 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
144
136
} ) ;
145
137
} ) ;
146
138
147
- < < < << << HEAD
148
- it ( 'can install schema version 2' , ( ) => {
149
- return withDb ( 2 , db => {
150
- expect ( db . version ) . to . equal ( 2 ) ;
151
- // We should have all of the stores, we should have the target global row
152
- // and we should not have any targets counted, because there are none.
153
- expect ( getAllObjectStores ( db ) ) . to . have . members ( V2_STORES ) ;
154
- // Check the target count. We haven't added any targets, so we expect 0.
155
- return getTargetCount ( db ) . then ( targetCount => {
156
- expect ( targetCount ) . to . equal ( 0 ) ;
157
- } ) ;
158
- } ) ;
159
- } ) ;
160
-
161
- it ( 'can install schema version 3' , ( ) => {
162
- return withDb ( 3 , async db => {
163
- expect ( db . version ) . to . be . equal ( 3 ) ;
164
- expect ( getAllObjectStores ( db ) ) . to . have . members ( V3_STORES ) ;
165
- } ) ;
166
- } ) ;
167
-
168
- it ( 'can upgrade from schema version 1 to 2' , ( ) => {
169
- const expectedTargetCount = 5 ;
170
- return withDb ( 1 , db => {
171
- = === ===
172
139
it ( 'drops the query cache from 2 to 3' , ( ) => {
173
140
const userId = 'user' ;
174
141
const batchId = 1 ;
@@ -189,7 +156,6 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
189
156
) ;
190
157
191
158
return withDb ( 2 , db => {
192
- > >>> >>> master
193
159
const sdb = new SimpleDb ( db ) ;
194
160
return sdb . runTransaction (
195
161
'readwrite' ,
@@ -213,24 +179,11 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
213
179
. next ( ( ) => mutations . put ( expectedMutation ) )
214
180
) ;
215
181
}
216
- << < < < << HEAD
217
- return p ;
218
- } ) ;
219
- } ) . then ( ( ) =>
220
- withDb ( 2 , db => {
221
- expect ( db . version ) . to . equal ( 2 ) ;
222
- expect ( getAllObjectStores ( db ) ) . to . have . members ( V2_STORES ) ;
223
- return getTargetCount ( db ) . then ( targetCount => {
224
- expect ( targetCount ) . to . equal ( expectedTargetCount ) ;
225
- } ) ;
226
- } )
227
- ) ;
228
- = === ===
229
182
) ;
230
183
} ) . then ( ( ) => {
231
184
return withDb ( 3 , db => {
232
185
expect ( db . version ) . to . equal ( 3 ) ;
233
- expect ( getAllObjectStores ( db ) ) . to . have . members ( ALL_STORES ) ;
186
+ expect ( getAllObjectStores ( db ) ) . to . have . members ( V3_STORES ) ;
234
187
235
188
const sdb = new SimpleDb ( db ) ;
236
189
return sdb . runTransaction (
@@ -259,7 +212,7 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
259
212
const expected = JSON . parse ( JSON . stringify ( resetTargetGlobal ) ) ;
260
213
expect ( targetGlobalEntry ) . to . deep . equal ( expected ) ;
261
214
} )
262
- . next ( ( ) => mutations . get ( [ userId , batchId ] ) )
215
+ . next ( ( ) => mutations . get ( batchId ) )
263
216
. next ( mutation => {
264
217
// Mutations should be unaffected.
265
218
expect ( mutation . userId ) . to . equal ( userId ) ;
@@ -269,10 +222,9 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
269
222
) ;
270
223
} ) ;
271
224
} ) ;
272
- > >>> >>> master
273
225
} ) ;
274
226
275
- it ( 'can upgrade from schema version 2 to 3 ' , ( ) => {
227
+ it ( 'can upgrade from schema version 3 to 4 ' , ( ) => {
276
228
const testWrite = { delete : 'foo' } ;
277
229
const testMutations = [
278
230
{
@@ -295,7 +247,7 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
295
247
}
296
248
] ;
297
249
298
- return withDb ( 2 , db => {
250
+ return withDb ( 3 , db => {
299
251
const sdb = new SimpleDb ( db ) ;
300
252
return sdb . runTransaction ( 'readwrite' , [ DbMutationBatch . store ] , txn => {
301
253
const store = txn . store ( DbMutationBatch . store ) ;
@@ -306,9 +258,9 @@ describe('IndexedDbSchema: createOrUpgradeDb', () => {
306
258
return p ;
307
259
} ) ;
308
260
} ) . then ( ( ) =>
309
- withDb ( 3 , db => {
310
- expect ( db . version ) . to . be . equal ( 3 ) ;
311
- expect ( getAllObjectStores ( db ) ) . to . have . members ( V3_STORES ) ;
261
+ withDb ( 4 , db => {
262
+ expect ( db . version ) . to . be . equal ( 4 ) ;
263
+ expect ( getAllObjectStores ( db ) ) . to . have . members ( V4_STORES ) ;
312
264
313
265
const sdb = new SimpleDb ( db ) ;
314
266
return sdb . runTransaction ( 'readwrite' , [ DbMutationBatch . store ] , txn => {
0 commit comments