From 80a2ff063989ab5d0226711231433e80c1c13e62 Mon Sep 17 00:00:00 2001 From: Daniel Pokorny Date: Tue, 9 Apr 2024 16:08:51 +0200 Subject: [PATCH] add tests --- tests/integration/importExport/clean.test.ts | 8 +++++--- tests/integration/importExport/utils/compare.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/integration/importExport/clean.test.ts b/tests/integration/importExport/clean.test.ts index 55c41e89..04f1804a 100644 --- a/tests/integration/importExport/clean.test.ts +++ b/tests/integration/importExport/clean.test.ts @@ -49,17 +49,19 @@ describe("clean command", () => { it.concurrent( "Cleans only entities specified in the include parameter.", withTestEnvironment(async (environmentId) => { - const command = `clean -e=${environmentId} -k=${API_KEY} --include spaces contentItems taxonomies`; + const command = `clean -e=${environmentId} -k=${API_KEY} --include spaces contentItems contentTypes contentTypeSnippets workflows`; await runCommand(command); await expectSameEnvironments(environmentId, CLEAN_TEST_DATA_ENVIRONMENT_ID, { - exclude: ["spaces", "items", "taxonomies", "previewUrls"], + exclude: ["spaces", "items", "previewUrls", "types", "snippets", "workflows"], }); - await expectNoTaxonomies(environmentId); await expectNoItems(environmentId); await expectNoPreviewUrls(environmentId); + await expectNoSnippets(environmentId); + await expectNoTypes(environmentId, true); + await expectNoWorkflows(environmentId); }, false), ); diff --git a/tests/integration/importExport/utils/compare.ts b/tests/integration/importExport/utils/compare.ts index 35919158..cb361440 100644 --- a/tests/integration/importExport/utils/compare.ts +++ b/tests/integration/importExport/utils/compare.ts @@ -62,7 +62,7 @@ export const expectSameAllEnvData = ( has("taxonomies") && expect(sortByCodename(data1.taxonomies)).toStrictEqual(sortByCodename(data2.taxonomies)); has("assetFolders") && expect(data1.assetFolders).toStrictEqual(data2.assetFolders); has("assets") && expect(sortByCodename(data1.assets)).toStrictEqual(sortByCodename(data2.assets)); - has("roles") && expect(data1.roles).toStrictEqual(data2.roles); + has("roles") && expect(sortBy(data1.roles, r => r.name)).toStrictEqual(sortBy(data2.roles, r => r.name)); has("workflows") && expect(sortByCodename(data1.workflows)).toStrictEqual(sortByCodename(data2.workflows)); has("snippets") && expect(sortByCodename(data1.snippets)).toStrictEqual(sortByCodename(data2.snippets)); has("types") && expect(sortByCodename(data1.types)).toStrictEqual(sortByCodename(data2.types));