From 2f08d92b24a4731a9b10bae850bce95a2eb7340e Mon Sep 17 00:00:00 2001 From: Marc-Roig Date: Wed, 12 Mar 2025 11:47:51 +0100 Subject: [PATCH] chore: todo tests --- .../utils/bidirectional-relations.ts | 1 + tests/api/core/strapi/api/relations.test.api.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/packages/core/core/src/services/document-service/utils/bidirectional-relations.ts b/packages/core/core/src/services/document-service/utils/bidirectional-relations.ts index 766b72bca8..be1cfcfe7d 100644 --- a/packages/core/core/src/services/document-service/utils/bidirectional-relations.ts +++ b/packages/core/core/src/services/document-service/utils/bidirectional-relations.ts @@ -74,6 +74,7 @@ const load = async (uid: UID.ContentType, { oldVersions }: LoadContext) => { } // If it's a self referencing relation, there is no need to sync any relation + // The order will already be handled as both sides are inside the same content type if (model.uid === uid) { continue; } diff --git a/tests/api/core/strapi/api/relations.test.api.ts b/tests/api/core/strapi/api/relations.test.api.ts index 86b4b33b26..ee07b143f6 100644 --- a/tests/api/core/strapi/api/relations.test.api.ts +++ b/tests/api/core/strapi/api/relations.test.api.ts @@ -1,3 +1,15 @@ +/** + * TODO: + * # Bidirectional relations + * + * Testing bidirectional relations is a bit tricky with our current setup on the api test. + * As soon as we can test it we should implement: + * - Bidirectional relations targeting the same content type (self referencing) + * - Can connect, disconnect, reorder + * - Can publish and discard + * - Test inverse order of relations is preserved when publishing. + * + */ import { createTestBuilder } from 'api-tests/builder'; import { createStrapiInstance } from 'api-tests/strapi'; import { createContentAPIRequest } from 'api-tests/request';