@@ -98,6 +98,14 @@ function makeContext() {
98
98
}
99
99
}
100
100
101
+ class Person extends BaseModel {
102
+ public static modelName = 'Person'
103
+ public static servicePath : 'persons'
104
+ public constructor ( data ?, options ?) {
105
+ super ( data , options )
106
+ }
107
+ }
108
+
101
109
const store = new Vuex . Store < RootState > ( {
102
110
strict : true ,
103
111
plugins : [
@@ -114,6 +122,12 @@ function makeContext() {
114
122
Model : Letter ,
115
123
servicePath : 'letters' ,
116
124
service : feathersClient . service ( 'letters' )
125
+ } ) ,
126
+ makeServicePlugin ( {
127
+ Model : Person ,
128
+ servicePath : 'persons' ,
129
+ service : feathersClient . service ( 'persons' ) ,
130
+ keepCopiesInStore : true
117
131
} )
118
132
]
119
133
} )
@@ -122,6 +136,7 @@ function makeContext() {
122
136
Task,
123
137
Todo,
124
138
Letter,
139
+ Person,
125
140
lettersService,
126
141
store
127
142
}
@@ -284,8 +299,38 @@ describe('Models - Methods', function () {
284
299
assert ( ! store . state . tasks . tempsById [ tempId ] , 'temp was removed' )
285
300
} )
286
301
287
- it . skip ( 'instance.remove removes cloned records from the store' , function ( ) { } )
288
- it . skip ( 'instance.remove removes cloned records from the Model.copiesById' , function ( ) { } )
302
+ it . skip ( 'instance.remove removes cloned records from the store' , function ( ) {
303
+ const { Person, store } = makeContext ( )
304
+ const person = new Person ( { test : true } )
305
+ const tempId = person . __id
306
+
307
+ person . clone ( )
308
+
309
+ // @ts -ignore
310
+ assert ( store . state . persons . copiesById [ tempId ] , 'clone exists' )
311
+
312
+ person . remove ( )
313
+
314
+ // @ts -ignore
315
+ assert ( ! store . state . persons . copiesById [ tempId ] , 'clone was removed' )
316
+ } )
317
+
318
+ it . skip ( 'instance.remove removes cloned records from the Model.copiesById' , function ( ) {
319
+ const { Task, store } = makeContext ( )
320
+ const task = new Task ( { test : true } )
321
+ const tempId = task . __id
322
+
323
+ task . clone ( )
324
+
325
+ // @ts -ignore
326
+ assert ( Task . copiesById [ tempId ] , 'clone exists' )
327
+
328
+ task . remove ( )
329
+
330
+ // @ts -ignore
331
+ assert ( ! Task . copiesById [ tempId ] , 'clone was removed' )
332
+ } )
333
+
289
334
it . skip ( 'removes clone and original upon calling clone.remove()' , function ( ) { } )
290
335
291
336
it ( 'instance methods still available in store data after updateItem mutation (or socket event)' , async function ( ) {
0 commit comments