-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(
sqlite
): Retain Error object for unique constraint violation (#446
- Loading branch information
Showing
7 changed files
with
109 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const cds = require('../../cds.js') | ||
const bookshop = cds.utils.path.resolve(__dirname, '../../bookshop') | ||
|
||
describe('Bookshop - Insert', () => { | ||
const { expect } = cds.test(bookshop) | ||
|
||
test('unique constraing violation throws error', async () => { | ||
const { Books } = cds.entities('AdminService') | ||
const insert = INSERT({ ID: 201, title: 'Harry Potter' }).into(Books) | ||
const err = await expect(insert).rejected | ||
// Works fine locally, but refuses to function in pipeline | ||
// expect(err).to.be.instanceOf(Error) | ||
// expect(err instanceof Error).to.be.true | ||
expect(err.message).to.be.eq('ENTITY_ALREADY_EXISTS') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters