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


TypeScript MockStoreEnhanced.getActions方法代码示例

本文整理汇总了TypeScript中redux-mock-store.MockStoreEnhanced.getActions方法的典型用法代码示例。如果您正苦于以下问题:TypeScript MockStoreEnhanced.getActions方法的具体用法?TypeScript MockStoreEnhanced.getActions怎么用?TypeScript MockStoreEnhanced.getActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在redux-mock-store.MockStoreEnhanced的用法示例。


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

示例1: test

    test('success', async () => {
      await store.dispatch(User.sessionExpired())

      expect(store.getActions()).toEqual([
        { type: UserActions.SessionExpired.type },
      ])
    })
开发者ID:venicegeo,项目名称:bf-ui,代码行数:7,代码来源:userActions.test.ts

示例2: test

    test('success', async () => {
      const loc = {
        pathname: 'a',
        search: '?jobId=1&jobId=2&jobId=3',
        hash: 'b',
        selectedFeature: 'c',
      }

      const pushStateSpy = sinon.spy(history, 'pushState')

      await store.dispatch(Route.navigateTo({ loc } as any))

      const href = `${loc.pathname}${loc.search}${loc.hash}`

      expect(pushStateSpy.callCount).toEqual(1)
      expect(pushStateSpy.args[0]).toEqual([null, '', href])

      expect(store.getActions()).toEqual([
        {
          type: RouteActions.Changed.type,
          payload: {
            pathname: loc.pathname,
            search: loc.search,
            hash: loc.hash,
            selectedFeature: loc.selectedFeature,
            href,
            jobIds: ['1', '2', '3'],
          },
        },
      ])

      pushStateSpy.restore()
    })
开发者ID:venicegeo,项目名称:bf-ui,代码行数:33,代码来源:routeActions.test.ts

示例3: it

  it('should dispatch error on failure', async () => {
    const error = new Error('The server is on fire');
    mockAxios.request.mockRejectedValueOnce(error);

    const p = store.dispatch(requestAction);
    await expect(p).rejects.toEqual(error);

    expect(mockAxios.request).toBeCalledTimes(1);

    expect(store.getActions()).toMatchObject([
      {
        type: 'TEST_ACTION_REQUEST',
        meta: {
          requestStatus: REQUEST,
        },
      },
      {
        type: 'TEST_ACTION_FAILURE',
        payload: error,
        meta: {
          requestStatus: FAILURE,
        },
      },
    ]);
  });
开发者ID:nusmodifications,项目名称:nusmods,代码行数:25,代码来源:requests-middleware.test.ts

示例4: test

    test('success', async () => {
      await store.dispatch(Tour.end())

      expect(store.getActions()).toEqual([
        { type: TourActions.Ended.type },
      ])
    })
开发者ID:venicegeo,项目名称:bf-ui,代码行数:7,代码来源:tourActions.test.ts

示例5: test

    test('success', async () => {
      await store.dispatch(Map.clearBbox())

      expect(store.getActions()).toEqual([
        { type: MapActions.BboxCleared.type },
      ])
    })
开发者ID:venicegeo,项目名称:bf-ui,代码行数:7,代码来源:mapActions.test.ts

示例6: test

    test('success', async () => {
      const mockResponse = {
        geoserver: 'a',
        'enabled-platforms': ['a', 'b'],
      }
      mockAdapter.onGet('/').reply(200, mockResponse)

      await store.dispatch(ApiStatus.fetch() as any)

      expect(clientSpies.get.callCount).toEqual(1)
      expect(clientSpies.get.args[0]).toEqual(['/'])

      expect(store.getActions()).toEqual([
        { type: ApiStatusActions.Fetching.type },
        {
          type: ApiStatusActions.FetchSuccess.type,
          payload: {
            geoserver: {
              wmsUrl: mockResponse.geoserver + '/wms',
            },
            enabledPlatforms: mockResponse['enabled-platforms'],
          },
        },
      ])
    })
开发者ID:venicegeo,项目名称:bf-ui,代码行数:25,代码来源:apiStatusActions.test.ts


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