finished tests and docs

This commit is contained in:
lotte
2018-10-12 11:55:52 +02:00
parent 1928da8c32
commit 8ffbd13242
14 changed files with 426 additions and 33 deletions

View File

@@ -2,8 +2,11 @@ import * as deepFreeze from 'deep-freeze';
import { objectCacheReducer } from './object-cache.reducer';
import {
AddPatchObjectCacheAction,
AddToObjectCacheAction,
RemoveFromObjectCacheAction, ResetObjectCacheTimestampsAction
ApplyPatchObjectCacheAction,
RemoveFromObjectCacheAction,
ResetObjectCacheTimestampsAction
} from './object-cache.actions';
class NullAction extends RemoveFromObjectCacheAction {
@@ -136,4 +139,16 @@ describe('objectCacheReducer', () => {
objectCacheReducer(testState, action);
});
it('should perform the ADD_PATCH action without affecting the previous state', () => {
const action = new AddPatchObjectCacheAction(selfLink1, [{ op: 'replace', path: '/name', value: 'random string' }]);
// testState has already been frozen above
objectCacheReducer(testState, action);
});
it('should perform the APPLY_PATCH action without affecting the previous state', () => {
const action = new ApplyPatchObjectCacheAction(selfLink1);
// testState has already been frozen above
objectCacheReducer(testState, action);
});
});