当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript testing.TestBedStatic类代码示例

本文整理汇总了TypeScript中@angular/core/testing.TestBedStatic的典型用法代码示例。如果您正苦于以下问题:TypeScript TestBedStatic类的具体用法?TypeScript TestBedStatic怎么用?TypeScript TestBedStatic使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TestBedStatic类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: describe

    describe("when the root store is created", () => {
        let injector: TestBedStatic

        const initialState = {
            isInitialised: true,
            computed: () => 1 + 1,
        }
        const computedState = {
            isInitialised: true,
            computed: 2,
        }

        beforeEach(() => {
            injector = createTestStoreForRoot(() => initialState)
        })

        it("should be created", () => {
            const result = injector.get(Store)

            expect(result).toBeInstanceOf(Store)
            expect(result).toBeInstanceOf(Observable)
        })

        it("should initialise the state and calculate computed properties", () => {
            const subject: Store<any> = injector.get(Store)

            expect(subject.state).toEqual(computedState)
        })
    })
开发者ID:zodiac-team,项目名称:zodiac-ui,代码行数:29,代码来源:store.service.spec.ts

示例2: beforeEach

    beforeEach(async(() => {
        testbed = TestBed.configureTestingModule({
            imports: [FormulaModule],
            declarations: [FakeComponent, FakeInputComponent],
            providers: [],
        })

        testbed.overrideModule(BrowserDynamicTestingModule, {
            set: {
                entryComponents: [FakeComponent, FakeInputComponent],
            },
        })

        void testbed.compileComponents()
    }))
开发者ID:zodiac-team,项目名称:zodiac-ui,代码行数:15,代码来源:formula.directive.spec.ts

示例3: it

        it("should dispatch an action", async(() => {
            const subject: Actions = injector.get(Actions)
            const result = { type: "ACTION" }

            subject.pipe(take(1)).subscribe(action => expect(action).toEqual(result))

            store.dispatch(result)
        }))
开发者ID:zodiac-team,项目名称:zodiac-ui,代码行数:8,代码来源:store.service.spec.ts


注:本文中的@angular/core/testing.TestBedStatic类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。