This repository has been archived by the owner on Dec 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into develop
- Loading branch information
Showing
14 changed files
with
588 additions
and
1,408 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import 'jest-preset-angular'; | ||
import './global-mocks'; | ||
|
||
import { reset } from '../../src/utils/helpers'; | ||
import { resetPackage } from '../../src/utils/helpers'; | ||
|
||
afterEach(reset); | ||
afterEach(resetPackage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { Routes } from '@angular/router'; | ||
import { createNote } from './note.creator'; | ||
import { createSlice } from './slice.creator'; | ||
import { Structure } from '../interfaces/common.interfaces'; | ||
|
||
describe('createSlice', () => { | ||
it('should create basic without parent', () => { | ||
const routes: Routes = [{ path: '' }]; | ||
const notes = createNote(routes); | ||
const result = { | ||
root: { | ||
id: 0, | ||
name: 'root', | ||
parentId: null, | ||
path: '', | ||
state: ['/'] | ||
} | ||
}; | ||
expect(createSlice(null, notes)).toEqual(result); | ||
}); | ||
|
||
it('should create slice of few routes', () => { | ||
const routes: Routes = [{ path: '' }, { path: 'about' }, { path: 'map' }]; | ||
const notes = createNote(routes); | ||
const result = { | ||
root: { | ||
id: 0, | ||
name: 'root', | ||
parentId: null, | ||
path: '', | ||
state: ['/'] | ||
}, | ||
about: { | ||
id: 1, | ||
name: 'about', | ||
parentId: null, | ||
path: 'about', | ||
state: ['/', 'about'] | ||
}, | ||
map: { | ||
id: 2, | ||
name: 'map', | ||
parentId: null, | ||
path: 'map', | ||
state: ['/', 'map'] | ||
} | ||
}; | ||
expect(createSlice(null, notes)).toEqual(result); | ||
}); | ||
|
||
it('should create slice of few routes with parent', () => { | ||
const parentStructure: Structure = { | ||
id: 0, | ||
parentId: null, | ||
state: ['/', 'admin'], | ||
name: 'root', | ||
path: '' | ||
}; | ||
const routes: Routes = [{ path: '' }, { path: 'about' }, { path: 'map' }]; | ||
const notes = createNote(routes); | ||
const result = { | ||
root: { | ||
id: 0, | ||
name: 'root', | ||
parentId: 0, | ||
path: '', | ||
state: ['/', 'admin'] | ||
}, | ||
about: { | ||
id: 1, | ||
name: 'about', | ||
parentId: 0, | ||
path: 'about', | ||
state: ['/', 'admin', 'about'] | ||
}, | ||
map: { | ||
id: 2, | ||
name: 'map', | ||
parentId: 0, | ||
path: 'map', | ||
state: ['/', 'admin', 'map'] | ||
} | ||
}; | ||
expect(createSlice(parentStructure, notes)).toEqual(result); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.