Skip to content

Commit 5ba26b3

Browse files
authored
testkit: Enabling more tests scenarios (#663)
* testkit-backend: Implement ResultConsume * testkit-backend: Implement TransactionRollback
1 parent 153f31f commit 5ba26b3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

testkit-backend/request-handlers.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ export function ResultNext (context, data, wire) {
104104
})
105105
}
106106

107+
export function ResultConsume (context, data, wire) {
108+
const { resultId } = data
109+
const resultObserver = context.getResultObserver(resultId)
110+
resultObserver
111+
.completitionPromise()
112+
.then(summary => {
113+
wire.writeResponse('Summary', null)
114+
})
115+
.catch(e => wire.writeError(e))
116+
}
117+
107118
export function SessionReadTransaction (context, data, wire) {
108119
const { sessionId } = data
109120
const session = context.getSession(sessionId)
@@ -171,6 +182,15 @@ export function TransactionCommit (context, data, wire) {
171182
context.removeTx(id)
172183
}
173184

185+
export function TransactionRollback (context, data, wire) {
186+
const { txId: id } = data
187+
const { tx } = context.getTx(id)
188+
tx.rollback()
189+
.then(() => wire.writeResponse('Transaction', { id }))
190+
.catch(e => wire.writeError(e))
191+
context.removeTx(id)
192+
}
193+
174194
export function SessionLastBookmarks (context, data, wire) {
175195
const { sessionId } = data
176196
const session = context.getSession(sessionId)

0 commit comments

Comments
 (0)