From 975e665f6cd06447bbe7df54b79dba1206202a2e Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Thu, 26 Apr 2018 14:11:14 +0200 Subject: [PATCH] services: test case for ``undefined`` pathces Signed-off-by: Harris Tzovanakis --- src/shared/services/json-store.service.spec.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/shared/services/json-store.service.spec.ts b/src/shared/services/json-store.service.spec.ts index d36c8859..db2370f1 100644 --- a/src/shared/services/json-store.service.spec.ts +++ b/src/shared/services/json-store.service.spec.ts @@ -291,7 +291,7 @@ describe('JsonStoreService', () => { service.rollbackLastChange(); }); - it('shoul set json patches and group them by path', () => { + it('should set json patches and group them by path', () => { const patches = [ { path: '/p/1', @@ -335,7 +335,7 @@ describe('JsonStoreService', () => { service.setJsonPatches(patches); }); - it('shoul return true for parent if a child has a patch', () => { + it('should return true for parent if a child has a patch', () => { const patches = [ { path: '/parent/children/0', @@ -351,7 +351,7 @@ describe('JsonStoreService', () => { expect(service.hasPatchOrChildrenHavePatch('/parent')).toBe(true); }); - it('shoul return true for parent if it has a patch', () => { + it('should return true for parent if it has a patch', () => { const patches = [ { path: '/parent', @@ -367,7 +367,7 @@ describe('JsonStoreService', () => { expect(service.hasPatchOrChildrenHavePatch('/parent')).toBe(true); }); - it('shoul return false for parent if it or a child does not have a patch', () => { + it('should return false for parent if it or a child does not have a patch', () => { const patches = [ { path: '/other/thing', @@ -377,4 +377,10 @@ describe('JsonStoreService', () => { service.setJsonPatches(patches); expect(service.hasPatchOrChildrenHavePatch('/parent')).toBe(false); }); + + it('should return false if patch is undefiled', () => { + const patches = undefined; + service.setJsonPatches(patches); + expect(service.hasPatchOrChildrenHavePatch('/parent')).toBe(false); + }); });