diff --git a/tests/integration/sync/syncModel.test.ts b/tests/integration/sync/syncModel.test.ts index 9eff4d85..031eadb2 100644 --- a/tests/integration/sync/syncModel.test.ts +++ b/tests/integration/sync/syncModel.test.ts @@ -3,14 +3,7 @@ import * as fsPromises from "fs/promises"; import * as path from "path"; import { describe, expect, it } from "vitest"; -import { - assetFoldersFileName, - collectionsFileName, - contentTypesFileName, - contentTypeSnippetsFileName, - taxonomiesFileName, - webSpotlightFileName, -} from "../../../src/modules/sync/constants/filename.ts"; +import * as fileNames from "../../../src/modules/sync/constants/filename.ts"; import { syncModelRun } from "../../../src/public.ts"; import { expectSameAllEnvData, prepareReferences } from "../importExport/utils/compare.ts"; import { AllEnvData, loadAllEnvData } from "../importExport/utils/envData.ts"; @@ -92,33 +85,15 @@ describe.concurrent("Sync environment from folder", () => { .then(stats => stats.isDirectory()) .catch(() => false); - const typesJsonExists = await fsPromises.stat(`${folderPath}/${contentTypesFileName}`) - .then(stats => stats.isFile()) - .catch(() => false); - const snippetJsonExists = await fsPromises.stat(`${folderPath}/${contentTypeSnippetsFileName}`) - .then(stats => stats.isFile()) - .catch(() => false); - const taxonomiesJsonExists = await fsPromises.stat(`${folderPath}/${taxonomiesFileName}`) - .then(stats => stats.isFile()) - .catch(() => false); + expect(folderExists).toEqual(true); - const webSpotlightJsonExists = await fsPromises.stat(`${folderPath}/${webSpotlightFileName}`) - .then(stats => stats.isFile()) - .catch(() => false); - const assetFoldersJsonExists = await fsPromises.stat(`${folderPath}/${assetFoldersFileName}`) - .then(stats => stats.isFile()) - .catch(() => false); - const collectionsJsonExists = await fsPromises.stat(`${folderPath}/${collectionsFileName}`) - .then(stats => stats.isFile()) - .catch(() => false); + const result = await Promise.all( + Object.entries(fileNames).map(([, filename]) => + fsPromises.stat(`${folderPath}/${filename}`).then(stats => stats.isFile()).catch(() => false) + ), + ); - expect(folderExists).toEqual(true); - expect(typesJsonExists).toEqual(true); - expect(snippetJsonExists).toEqual(true); - expect(taxonomiesJsonExists).toEqual(true); - expect(webSpotlightJsonExists).toEqual(true); - expect(assetFoldersJsonExists).toEqual(true); - expect(collectionsJsonExists).toEqual(true); + expect(result.every(res => res)).toEqual(true); }); it.sequential(