Skip to content

Commit

Permalink
test(effects): add test cases for effect factory (#2818)
Browse files Browse the repository at this point in the history
Closes #2817.
  • Loading branch information
moniuch authored Dec 12, 2020
1 parent 7c6e6c8 commit 705ae44
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/effects/spec/effects_metadata.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ describe('Effects metadata', () => {
@Effect({ dispatch: false, useEffectsErrorHandler: false })
e: any;
z: any;
f = createEffect(() => () => of({ type: 'a' }));
g = createEffect(() => () => of({ type: 'a' }), { dispatch: false });
h = createEffect(() => () => of({ type: 'a' }), {
dispatch: true,
useEffectsErrorHandler: false,
});
}

const mock = new Fixture();
Expand All @@ -24,6 +30,9 @@ describe('Effects metadata', () => {
{ propertyName: 'b', dispatch: true, useEffectsErrorHandler: true },
{ propertyName: 'd', dispatch: false, useEffectsErrorHandler: true },
{ propertyName: 'e', dispatch: false, useEffectsErrorHandler: false },
{ propertyName: 'f', dispatch: true, useEffectsErrorHandler: true },
{ propertyName: 'g', dispatch: false, useEffectsErrorHandler: true },
{ propertyName: 'h', dispatch: true, useEffectsErrorHandler: false },
];

expect(getSourceMetadata(mock)).toEqual(
Expand All @@ -47,6 +56,12 @@ describe('Effects metadata', () => {
g = createEffect(() => of({ type: 'g' }), {
useEffectsErrorHandler: false,
});
h = createEffect(() => () => of({ type: 'a' }));
j = createEffect(() => () => of({ type: 'a' }), { dispatch: false });
k = createEffect(() => () => of({ type: 'a' }), {
dispatch: true,
useEffectsErrorHandler: false,
});
}

const mock = new Fixture();
Expand All @@ -59,6 +74,9 @@ describe('Effects metadata', () => {
d: { dispatch: true, useEffectsErrorHandler: true },
f: { dispatch: false, useEffectsErrorHandler: true },
g: { dispatch: true, useEffectsErrorHandler: false },
h: { dispatch: true, useEffectsErrorHandler: true },
j: { dispatch: false, useEffectsErrorHandler: true },
k: { dispatch: true, useEffectsErrorHandler: false },
});
});

Expand Down

0 comments on commit 705ae44

Please sign in to comment.