@@ -109,45 +109,42 @@ async function readRecords(
109109}
110110
111111describe ( "the completed-waitpoint record set" , ( ) => {
112- containerTest ( "a mint writes the records the caller supplied" , async ( {
113- prisma ,
114- redisOptions ,
115- } ) => {
116- const { decorated , redis } = build ( prisma as never , redisOptions as never ) ;
117- const probe = createRedisClient ( redisOptions , { onError : ( ) => { } } ) ;
118- try {
119- const env = await seedSnapshotEnvironment ( prisma ) ;
120- const runId = await seedRun ( decorated , redis , env ) ;
121- const [ wpA , wpB ] = await seedSnapshotWaitpoints ( prisma , env , 2 ) ;
122-
123- await decorated . createExecutionSnapshot (
124- resumeInput (
125- runId ,
126- env ,
127- [
128- { id : wpA ! , index : 0 } ,
129- { id : wpB ! , index : 1 } ,
130- ] ,
131- [ record ( wpA ! ) , record ( wpB ! ) ]
132- )
133- ) ;
134-
135- const records = await readRecords ( probe , runId ) ;
136-
137- expect ( records ) . toHaveLength ( 2 ) ;
138- expect ( records ?. map ( ( r ) => r . id ) . sort ( ) ) . toEqual ( [ wpA , wpB ] . sort ( ) ) ;
139- expect ( records ?. [ 0 ] ?. output ) . toEqual ( { inline : '{"ok":true}' } ) ;
140- } finally {
141- await Promise . all ( [ redis . quit ( ) , probe . quit ( ) . catch ( ( ) => { } ) ] ) ;
112+ containerTest (
113+ "a mint writes the records the caller supplied" ,
114+ async ( { prisma , redisOptions } ) => {
115+ const { decorated , redis } = build ( prisma as never , redisOptions as never ) ;
116+ const probe = createRedisClient ( redisOptions , { onError : ( ) => { } } ) ;
117+ try {
118+ const env = await seedSnapshotEnvironment ( prisma ) ;
119+ const runId = await seedRun ( decorated , redis , env ) ;
120+ const [ wpA , wpB ] = await seedSnapshotWaitpoints ( prisma , env , 2 ) ;
121+
122+ await decorated . createExecutionSnapshot (
123+ resumeInput (
124+ runId ,
125+ env ,
126+ [
127+ { id : wpA ! , index : 0 } ,
128+ { id : wpB ! , index : 1 } ,
129+ ] ,
130+ [ record ( wpA ! ) , record ( wpB ! ) ]
131+ )
132+ ) ;
133+
134+ const records = await readRecords ( probe , runId ) ;
135+
136+ expect ( records ) . toHaveLength ( 2 ) ;
137+ expect ( records ?. map ( ( r ) => r . id ) . sort ( ) ) . toEqual ( [ wpA , wpB ] . sort ( ) ) ;
138+ expect ( records ?. [ 0 ] ?. output ) . toEqual ( { inline : '{"ok":true}' } ) ;
139+ } finally {
140+ await Promise . all ( [ redis . quit ( ) , probe . quit ( ) . catch ( ( ) => { } ) ] ) ;
141+ }
142142 }
143- } ) ;
143+ ) ;
144144
145145 // The inertness guarantee. A wait with no store-resident half supplies no records, and the
146146 // cycle key must then hold none — a Postgres-resident resume is unchanged.
147- containerTest ( "a mint with no records supplied writes none" , async ( {
148- prisma,
149- redisOptions,
150- } ) => {
147+ containerTest ( "a mint with no records supplied writes none" , async ( { prisma, redisOptions } ) => {
151148 const { decorated, redis } = build ( prisma as never , redisOptions as never ) ;
152149 const probe = createRedisClient ( redisOptions , { onError : ( ) => { } } ) ;
153150 try {
@@ -174,12 +171,8 @@ describe("the completed-waitpoint record set", () => {
174171 const [ wpA ] = await seedSnapshotWaitpoints ( prisma , env , 1 ) ;
175172
176173 const waitpoints = [ { id : wpA ! , index : 0 } ] ;
177- await decorated . createExecutionSnapshot (
178- resumeInput ( runId , env , waitpoints , [ record ( wpA ! ) ] )
179- ) ;
180- await decorated . createExecutionSnapshot (
181- resumeInput ( runId , env , waitpoints , [ record ( wpA ! ) ] )
182- ) ;
174+ await decorated . createExecutionSnapshot ( resumeInput ( runId , env , waitpoints , [ record ( wpA ! ) ] ) ) ;
175+ await decorated . createExecutionSnapshot ( resumeInput ( runId , env , waitpoints , [ record ( wpA ! ) ] ) ) ;
183176
184177 const cycleKeys = await probe . keys ( `snap:{${ runId } }:wp:*` ) ;
185178
@@ -190,37 +183,37 @@ describe("the completed-waitpoint record set", () => {
190183 }
191184 } ) ;
192185
193- containerTest ( "a record set survives beside a repeat-preserving order" , async ( {
194- prisma ,
195- redisOptions ,
196- } ) => {
197- const { decorated , redis } = build ( prisma as never , redisOptions as never ) ;
198- const probe = createRedisClient ( redisOptions , { onError : ( ) => { } } ) ;
199- try {
200- const env = await seedSnapshotEnvironment ( prisma ) ;
201- const runId = await seedRun ( decorated , redis , env ) ;
202- const [ wpA ] = await seedSnapshotWaitpoints ( prisma , env , 1 ) ;
203-
204- const created = await decorated . createExecutionSnapshot (
205- resumeInput (
206- runId ,
207- env ,
208- [
209- { id : wpA ! , index : 0 } ,
210- { id : wpA ! , index : 1 } ,
211- ] ,
212- [ record ( wpA ! ) ]
213- )
214- ) ;
215-
216- const ids = await redis . getSnapshotWaitpointIds ( runId , created . id ) ;
217-
218- // One record, two positions. The record set carries membership, the order carries
219- // multiplicity.
220- expect ( await readRecords ( probe , runId ) ) . toHaveLength ( 1 ) ;
221- expect ( ids . order ) . toEqual ( [ wpA , wpA ] ) ;
222- } finally {
223- await Promise . all ( [ redis . quit ( ) , probe . quit ( ) . catch ( ( ) => { } ) ] ) ;
186+ containerTest (
187+ "a record set survives beside a repeat-preserving order" ,
188+ async ( { prisma , redisOptions } ) => {
189+ const { decorated , redis } = build ( prisma as never , redisOptions as never ) ;
190+ const probe = createRedisClient ( redisOptions , { onError : ( ) => { } } ) ;
191+ try {
192+ const env = await seedSnapshotEnvironment ( prisma ) ;
193+ const runId = await seedRun ( decorated , redis , env ) ;
194+ const [ wpA ] = await seedSnapshotWaitpoints ( prisma , env , 1 ) ;
195+
196+ const created = await decorated . createExecutionSnapshot (
197+ resumeInput (
198+ runId ,
199+ env ,
200+ [
201+ { id : wpA ! , index : 0 } ,
202+ { id : wpA ! , index : 1 } ,
203+ ] ,
204+ [ record ( wpA ! ) ]
205+ )
206+ ) ;
207+
208+ const ids = await redis . getSnapshotWaitpointIds ( runId , created . id ) ;
209+
210+ // One record, two positions. The record set carries membership, the order carries
211+ // multiplicity.
212+ expect ( await readRecords ( probe , runId ) ) . toHaveLength ( 1 ) ;
213+ expect ( ids . order ) . toEqual ( [ wpA , wpA ] ) ;
214+ } finally {
215+ await Promise . all ( [ redis . quit ( ) , probe . quit ( ) . catch ( ( ) => { } ) ] ) ;
216+ }
224217 }
225- } ) ;
218+ ) ;
226219} ) ;
0 commit comments