Skip to content

Commit

Permalink
Update test select in handler
Browse files Browse the repository at this point in the history
  • Loading branch information
FreePhoenix888 committed Nov 18, 2023
1 parent ffeb19e commit 8539b75
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/sync-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3035,14 +3035,18 @@ describe('sync handlers', () => {
type_id: await deep.id("@deep-foundation/core", "Type")
}).then(result => result.data[0].id);
const handleInsertTypeLinkId = await deep.id('@deep-foundation/core', 'HandleInsert');
const supportsId = await deep.id("@deep-foundation/core", "plv8SupportsJs")
const handler = await insertHandler(handleInsertTypeLinkId, customTypeLinkId,
`(arg) => {
const deepSelectResult = deep.select({
id: ${customTypeLinkId}
})
if(!deepSelectResult) {
if(deepSelectResult.data.length === 0) {
throw new Error('Select in handler returns empty array');
}
}`);
}`, undefined, supportsId);
await deep.insert({
type_id: customTypeLinkId
})
})
});

0 comments on commit 8539b75

Please sign in to comment.