(facts: Facts)
| 26 | |
| 27 | /** A source answering from fixed facts, recording which reads were made. */ |
| 28 | const sourceOf = (facts: Facts) => { |
| 29 | const reads: string[] = []; |
| 30 | const answer = <A>(read: string, value: A) => |
| 31 | Effect.suspend(() => { |
| 32 | reads.push(read); |
| 33 | return facts.failing === read ? Effect.fail("unavailable") : Effect.succeed(value); |
| 34 | }); |
| 35 | const source: V2ImportSource = { |
| 36 | emailVerified: (userId) => { |
| 37 | expect(userId).toBe(USER); |
| 38 | return answer("user", facts.emailVerified ?? true); |
| 39 | }, |
| 40 | activeMemberIds: (organizationId) => { |
| 41 | expect(organizationId).toBe(ORG); |
| 42 | return answer("members", facts.members ?? [USER]); |
| 43 | }, |
| 44 | subscriptions: (organizationId) => { |
| 45 | expect(organizationId).toBe(ORG); |
| 46 | return answer("billing", facts.subscriptions ?? [{ planId: "free", status: "active" }]); |
| 47 | }, |
| 48 | }; |
| 49 | return { source, reads }; |
| 50 | }; |
| 51 | |
| 52 | describe("v2 import eligibility", () => { |
| 53 | it.effect("admits a verified user who is the free org's only active member", () => |
no test coverage detected