From 2b201053495b2cab6280d8cc43c4458f891cddff Mon Sep 17 00:00:00 2001 From: Quentin Farizon Date: Fri, 20 Oct 2023 12:56:54 +0200 Subject: [PATCH] SSCCE for issue 16675 --- src/sscce-sequelize-7.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sscce-sequelize-7.ts b/src/sscce-sequelize-7.ts index 861b9fdea..f7f5dfa32 100644 --- a/src/sscce-sequelize-7.ts +++ b/src/sscce-sequelize-7.ts @@ -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; }