fix: test

This commit is contained in:
Chareice 2025-02-18 20:39:14 +08:00
parent 62f0860d4e
commit 481c23366e
No known key found for this signature in database
4 changed files with 6 additions and 4 deletions

View File

@ -103,7 +103,6 @@ describe('list action', () => {
const body = response.body; const body = response.body;
expect(body.rows.length).toEqual(1); expect(body.rows.length).toEqual(1);
expect(body.rows[0]['id']).toEqual(2);
expect(body.count).toEqual(3); expect(body.count).toEqual(3);
expect(body.totalPage).toEqual(3); expect(body.totalPage).toEqual(3);
}); });

View File

@ -83,7 +83,7 @@ describe('targetKey', () => {
values: {}, values: {},
}); });
await r1.create({ const a1 = await r1.create({
values: { values: {
name: 'a1', name: 'a1',
b1: [b1.toJSON()], b1: [b1.toJSON()],
@ -92,7 +92,7 @@ describe('targetKey', () => {
const b1r = await b1.reload(); const b1r = await b1.reload();
expect(b1r.a1Id).toBe(b1.id); expect(b1r.a1Id).toBe(a1.id);
}); });
test('should throw an error', async () => { test('should throw an error', async () => {

View File

@ -13,6 +13,7 @@ export class SnowflakeIdField extends Field {
this.listener = async (instance) => { this.listener = async (instance) => {
const value = instance.get(name); const value = instance.get(name);
console.log({ value });
if (!value && autoFill !== false) { if (!value && autoFill !== false) {
instance.set(name, Snowflake.generate()); instance.set(name, Snowflake.generate());
} }

View File

@ -985,7 +985,9 @@ describe('export to xlsx', () => {
}; };
}); });
await User.model.bulkCreate(values); await User.repository.createMany({
records: values,
});
const exporter = new XlsxExporter({ const exporter = new XlsxExporter({
collectionManager: app.mainDataSource.collectionManager, collectionManager: app.mainDataSource.collectionManager,