it('dispatches addonRemovedFromCollection after removing an add-on from a collection', async () => {
      mockApi
        .expects('removeAddonFromCollection')
        .once()
        .returns(Promise.resolve());

      _removeAddonFromCollection();

      const expectedRemovedAction = addonRemovedFromCollection();

      const removedAction = await sagaTester.waitFor(
        expectedRemovedAction.type,
      );
      expect(removedAction).toEqual(expectedRemovedAction);

      mockApi.verify();
    });
Example #2
0
    it('unsets a hasAddonBeenRemoved flag when beginning to remove an add-on from a collection', () => {
      let state = reducer(undefined, addonRemovedFromCollection());

      state = reducer(
        state,
        removeAddonFromCollection({
          addonId: 1,
          collectionId: 3,
          errorHandlerId: 'error-handler',
          filters: {},
          slug: 'some-collection',
          userId: 'some-user',
        }),
      );

      expect(state.hasAddonBeenRemoved).toEqual(false);
    });
Example #3
0
    it('sets a hasAddonBeenRemoved flag after an add-on has been removed', () => {
      const state = reducer(undefined, addonRemovedFromCollection());

      expect(state.hasAddonBeenRemoved).toEqual(true);
    });