File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -373,4 +373,33 @@ describe('Models - Temp Ids', function() {
373
373
} )
374
374
. catch ( done )
375
375
} )
376
+
377
+ it ( 'removes __isTemp from temp and clone' , function ( ) {
378
+ const { makeServicePlugin, BaseModel } = feathersVuex ( feathersClient , {
379
+ idField : '_id' ,
380
+ serverAlias : 'temp-ids'
381
+ } )
382
+ class Thing extends BaseModel {
383
+ public static modelName = 'Thing'
384
+ }
385
+ const store = new Vuex . Store < RootState > ( {
386
+ plugins : [
387
+ makeServicePlugin ( {
388
+ Model : Thing ,
389
+ service : feathersClient . service ( 'things' )
390
+ } )
391
+ ]
392
+ } )
393
+
394
+ const thing = new Thing ( )
395
+ assert ( thing . __isTemp , 'thing has __isTemp' )
396
+
397
+ const clone = thing . clone ( )
398
+ assert ( clone . __isTemp , 'Clone also has __isTemp' )
399
+
400
+ store . commit ( 'things/remove__isTemp' , thing )
401
+
402
+ assert ( ! thing . hasOwnProperty ( '__isTemp' ) , '__isTemp was removed from thing' )
403
+ assert ( ! clone . hasOwnProperty ( '__isTemp' ) , '__isTemp was removed from clone' )
404
+ } )
376
405
} )
You can’t perform that action at this time.
0 commit comments