/
githubmirror
/
strapi
Обзор
Документация
Войти
/
githubmirror
/
strapi
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
tests/api/core/database/v4-self-ref-compat.test.api.js
50 строк
1 KB
Alexandre BODIN
Update tests/api/core/database/v4-self-ref-compat.test.api.js
02 сен 2024, 18:08
Не верифицирован
02 сен 2024, 18:08
0374b69
Код
Авторство
О чём код?
'use strict'; // Test an API with all the possible filed types and simple filterings (no deep filtering, no relations) const { createStrapiInstance } = require('api-tests/strapi'); const { createTestBuilder } = require('api-tests/builder'); const builder = createTestBuilder(); let strapi; const testCT = { displayName: 'test', singularName: 'test', pluralName: 'tests', kind: 'collectionType', attributes: { children: { type: 'relation', relation: 'manyToMany', target: 'api::test.test', inversedBy: 'parents', }, parents: { type: 'relation', relation: 'manyToMany', target: 'api::test.test', inversedBy: 'children', // intentionally wrong to validate retro compatibility }, }, }; describe('v4-self-ref-compat', () => { beforeAll(async () => { await builder.addContentType(testCT).build(); strapi = await createStrapiInstance(); }); afterAll(async () => { await strapi.destroy(); await builder.cleanup(); }); test('2 tables are created', async () => { const hasFirstTable = await strapi.db.getConnection().schema.hasTable('tests_children_lnk'); const hasSecondTable = await strapi.db.getConnection().schema.hasTable('tests_parents_lnk'); expect(hasFirstTable).toBe(true); expect(hasSecondTable).toBe(true); }); });