|
|
|
@ -91,6 +91,18 @@ describe('SchemasState', () => { |
|
|
|
it('should load schemas', () => { |
|
|
|
expect(schemasState.snapshot.schemas.values).toEqual(oldSchemas); |
|
|
|
expect(schemasState.snapshot.isLoaded).toBeTruthy(); |
|
|
|
expect(schemasState.snapshot.categories).toEqual({ 'category1': false, 'category2': false }); |
|
|
|
|
|
|
|
schemasService.verifyAll(); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should not remove custom category when loading schemas', () => { |
|
|
|
schemasState.addCategory('category3'); |
|
|
|
schemasState.load(true).subscribe(); |
|
|
|
|
|
|
|
expect(schemasState.snapshot.schemas.values).toEqual(oldSchemas); |
|
|
|
expect(schemasState.snapshot.isLoaded).toBeTruthy(); |
|
|
|
expect(schemasState.snapshot.categories).toEqual({ 'category1': false, 'category2': false, 'category3': true }); |
|
|
|
|
|
|
|
schemasService.verifyAll(); |
|
|
|
}); |
|
|
|
@ -101,6 +113,18 @@ describe('SchemasState', () => { |
|
|
|
dialogs.verify(x => x.notifyInfo(It.isAnyString()), Times.once()); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should add category', () => { |
|
|
|
schemasState.addCategory('category3'); |
|
|
|
|
|
|
|
expect(schemasState.snapshot.categories).toEqual({ 'category1': false, 'category2': false, 'category3': true }); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should remove category', () => { |
|
|
|
schemasState.removeCategory('category1'); |
|
|
|
|
|
|
|
expect(schemasState.snapshot.categories).toEqual({ 'category2': false }); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should return schema on select and reload when already loaded', () => { |
|
|
|
schemasState.select('name2').subscribe(); |
|
|
|
schemasState.select('name2').subscribe(); |
|
|
|
|