Skip to content

Commit cdc4a5e

Browse files
committed
Fixes, bringing TE from command.process through
1 parent e6d1f32 commit cdc4a5e

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

tests/commands/memberNumbers/link-number-to-email.test.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,16 @@ describe('linkNumberToEmail', () => {
6565
actor: arbitraryActor(),
6666
}),
6767
];
68-
const result = linkNumberToEmail.process({command, events, deps: framework});
69-
it('returns none', () => {
68+
it('returns none', async () => {
69+
const result = pipe(
70+
await linkNumberToEmail.process({command, events, deps: framework})(),
71+
getRightOrFail,
72+
);
7073
expect(result).toStrictEqual(O.none);
7174
});
7275
});
7376

74-
describe('when the email address is already in use', async () => {
77+
describe('when the email address is already in use', () => {
7578
const events: ReadonlyArray<DomainEvent> = [
7679
constructEvent('MemberNumberLinkedToEmail')({
7780
memberNumber: faker.number.int(),
@@ -81,29 +84,29 @@ describe('linkNumberToEmail', () => {
8184
actor: arbitraryActor(),
8285
}),
8386
];
84-
const result = pipe(
85-
await linkNumberToEmail.process({command, events, deps: framework})(),
86-
getRightOrFail,
87-
O.filter(
88-
isEventOfType('LinkingMemberNumberToAnAlreadyUsedEmailAttempted')
89-
),
90-
getSomeOrFail
91-
);
92-
it('raises an event documenting the attempt', () => {
87+
it('raises an event documenting the attempt', async () => {
88+
const result = pipe(
89+
await linkNumberToEmail.process({command, events, deps: framework})(),
90+
getRightOrFail,
91+
O.filter(
92+
isEventOfType('LinkingMemberNumberToAnAlreadyUsedEmailAttempted')
93+
),
94+
getSomeOrFail
95+
);
9396
expect(result.email).toStrictEqual(command.email);
9497
});
9598
});
9699

97-
describe('when both the email and member number are new', async () => {
100+
describe('when both the email and member number are new', () => {
98101
const events: ReadonlyArray<DomainEvent> = [];
99-
const event = pipe(
100-
await linkNumberToEmail.process({command, events, deps: framework})(),
101-
getRightOrFail,
102-
O.filter(isEventOfType('MemberNumberLinkedToEmail')),
103-
getSomeOrFail
104-
);
105102

106-
it('raises an event linking the number and email', () => {
103+
it('raises an event linking the number and email', async () => {
104+
const event = pipe(
105+
await linkNumberToEmail.process({command, events, deps: framework})(),
106+
getRightOrFail,
107+
O.filter(isEventOfType('MemberNumberLinkedToEmail')),
108+
getSomeOrFail
109+
);
107110
expect(event.email).toStrictEqual(command.email);
108111
expect(event.memberNumber).toStrictEqual(command.memberNumber);
109112
});

0 commit comments

Comments
 (0)