Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSCCE for issue 16675 #265

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/sscce-sequelize-7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export async function run() {
await sequelize.sync({ force: true });
expect(spy).to.have.been.called;

console.log(await Foo.create({ name: 'TS foo' }));
expect(await Foo.count()).to.equal(1);
const foo = await Foo.create({ name: 'TS foo' });
console.log('findByPk OK');
expect(await Foo.findByPk(foo.getDataValue('id'))).to.not.be.null;
console.log('findByPk fake id with rejectOnEmpty rejects');
await expect(Foo.findByPk(2000, { rejectOnEmpty: true })).to.be.rejected;
console.log('findByPk null with rejectOnEmpty should reject');
await expect(Foo.findByPk(null, { rejectOnEmpty: true })).to.be.rejected;
}