@@ -649,6 +649,22 @@ describe('EntityChangeTrackerBase', () => {
649
649
} ) ;
650
650
651
651
describe ( '#undoOne' , ( ) => {
652
+ it ( 'should clear one tracked change' , ( ) => {
653
+ let { collection, deletedEntity } = createTestTrackedEntities ( ) ;
654
+
655
+ expect ( Object . keys ( collection . changeState ) . length ) . toBe (
656
+ 3 ,
657
+ 'tracking 3 entities'
658
+ ) ;
659
+
660
+ collection = tracker . undoOne ( deletedEntity as Hero , collection ) ;
661
+
662
+ expect ( Object . keys ( collection . changeState ) . length ) . toBe (
663
+ 2 ,
664
+ 'tracking 2 entities'
665
+ ) ;
666
+ } ) ;
667
+
652
668
it ( 'should restore the collection to the pre-change state for the given entity' , ( ) => {
653
669
// tslint:disable-next-line:prefer-const
654
670
let {
@@ -698,6 +714,32 @@ describe('EntityChangeTrackerBase', () => {
698
714
} ) ;
699
715
700
716
describe ( '#undoMany' , ( ) => {
717
+ it ( 'should clear many tracked changes' , ( ) => {
718
+ // tslint:disable-next-line:prefer-const
719
+ let {
720
+ collection,
721
+ addedEntity,
722
+ deletedEntity,
723
+ preUpdatedEntity,
724
+ updatedEntity,
725
+ } = createTestTrackedEntities ( ) ;
726
+
727
+ expect ( Object . keys ( collection . changeState ) . length ) . toBe (
728
+ 3 ,
729
+ 'tracking 3 entities'
730
+ ) ;
731
+
732
+ collection = tracker . undoMany (
733
+ [ addedEntity , deletedEntity , updatedEntity ] ,
734
+ collection
735
+ ) ;
736
+
737
+ expect ( Object . keys ( collection . changeState ) . length ) . toBe (
738
+ 0 ,
739
+ 'tracking 2 entities'
740
+ ) ;
741
+ } ) ;
742
+
701
743
it ( 'should restore the collection to the pre-change state for the given entities' , ( ) => {
702
744
// tslint:disable-next-line:prefer-const
703
745
let {
0 commit comments