diff options
author | 2019-11-26 15:31:39 +0000 | |
---|---|---|
committer | 2019-11-26 15:31:39 +0000 | |
commit | 32b4021333213679c6a77ca50c9bba07e47c5b9b (patch) | |
tree | 74c6fae30d18f7011c9c2c24609e2647f5183442 /cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.store.spec.ts | |
parent | adbbdf4f899833229f7244af91e4deb379a3a942 (diff) | |
parent | 6ee4d31800a68975294ef11156bea9a595b23adf (diff) |
Merge "add pacakges dashboard component to new cds ui"
Diffstat (limited to 'cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.store.spec.ts')
-rw-r--r-- | cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.store.spec.ts | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.store.spec.ts b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.store.spec.ts new file mode 100644 index 000000000..b091ed90e --- /dev/null +++ b/cds-ui/client-frankfurt/src/app/modules/feature-modules/packages/packages.store.spec.ts @@ -0,0 +1,44 @@ +import { TestBed } from '@angular/core/testing'; +import { PackagesStore } from './packages.store'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { PackagesListService } from './packages-list.service'; +import { of } from 'rxjs'; +import { BluePrintPage } from './model/BluePrint.model'; +import { getBluePrintPageMock } from './blueprint.page.mock'; + +describe('PackagesStore', () => { + let store: PackagesStore; + + const MOCK_BLUEPRINTS_PAGE: BluePrintPage = getBluePrintPageMock(); + + let httpMock: HttpTestingController; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [ + HttpClientTestingModule + ], + providers: [ + PackagesStore, + PackagesListService + ] + }); + httpMock = TestBed.get(HttpTestingController); + + }); + + it('should correctly get page of packages', () => { + const packagesServiceSpy = jasmine.createSpyObj('PackagesListService', ['getPagedPackages']); + + // set the value to return when the `getPagedPackages` spy is called. + packagesServiceSpy.getPagedPackages.and.returnValue(of([MOCK_BLUEPRINTS_PAGE])); + store = new PackagesStore(packagesServiceSpy); + + store.getPagedPackages(0, 2); + store.state$.subscribe(page => { + expect(store.state).toEqual(MOCK_BLUEPRINTS_PAGE); + }); + + }); +}); + |