Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

services: test case for undefined pathces #475

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/shared/services/json-store.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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);
});
});