(
org: string,
backfilledAt: Date | null,
active: number,
workos: Partial<WorkOSClientService> = {},
)
| 1528 | }); |
| 1529 | |
| 1530 | const report = ( |
| 1531 | org: string, |
| 1532 | backfilledAt: Date | null, |
| 1533 | active: number, |
| 1534 | workos: Partial<WorkOSClientService> = {}, |
| 1535 | ) => |
| 1536 | Effect.gen(function* () { |
| 1537 | const reported: { organizationId: string; seats: number }[] = []; |
| 1538 | const writes: string[] = []; |
| 1539 | const recording = Layer.succeed(AutumnService)({ |
| 1540 | use: () => Effect.die("the seat reporter sets seats, it does not read"), |
| 1541 | ensureCustomer: () => Effect.void, |
| 1542 | checkExecutionBalance: () => Effect.die("the seat reporter does not check balances"), |
| 1543 | trackExecution: () => Effect.void, |
| 1544 | setMemberSeats: (organizationId, seats) => |
| 1545 | Effect.sync(() => { |
| 1546 | reported.push({ organizationId, seats }); |
| 1547 | }), |
| 1548 | }); |
| 1549 | yield* forkReportMemberSeats(org).pipe( |
| 1550 | Effect.provide( |
| 1551 | Layer.mergeAll( |
| 1552 | recordingMirror(backfilledAt, writes), |
| 1553 | directoryWith(org, active), |
| 1554 | recording, |
| 1555 | stubWorkOS(workos), |
| 1556 | ), |
| 1557 | ), |
| 1558 | ); |
| 1559 | // The Autumn call is forked; it is synchronous here, so it has landed. |
| 1560 | return { reported, writes }; |
| 1561 | }); |
| 1562 | |
| 1563 | it.effect( |
| 1564 | "sets the active member count of a scanned organization without touching WorkOS", |
no test coverage detected