Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
chareice committed May 23, 2024
1 parent 6548195 commit 8f36b0d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/

import { primaryKey } from '@nocobase/client';
import { Database, mockDatabase } from '@nocobase/database';

describe('foreign key', () => {
Expand Down Expand Up @@ -50,7 +51,11 @@ describe('foreign key', () => {

await db.sync();

const foreignKey = posts.model.rawAttributes['userId'].field;

const indexes = await db.sequelize.getQueryInterface().showIndex(posts.getTableNameWithSchema());
expect(indexes).toHaveLength(2);

// @ts-ignore
expect(indexes.some((index) => index.fields.some((field) => field.attribute === foreignKey))).toBeTruthy();
});
});

0 comments on commit 8f36b0d

Please sign in to comment.