From 077a1e98306956f0912e93b5314f728ea06bf6af Mon Sep 17 00:00:00 2001 From: Evan Bacon Date: Fri, 28 Oct 2022 00:33:06 -0700 Subject: [PATCH] update e2e tests for export (#4579) --- .../__snapshots__/export-test.ts.snap | 99 ------------------- .../expo-cli/e2e/__tests__/export-test.ts | 21 ++-- 2 files changed, 15 insertions(+), 105 deletions(-) delete mode 100644 packages/expo-cli/e2e/__tests__/__snapshots__/export-test.ts.snap diff --git a/packages/expo-cli/e2e/__tests__/__snapshots__/export-test.ts.snap b/packages/expo-cli/e2e/__tests__/__snapshots__/export-test.ts.snap deleted file mode 100644 index a00b5ad296..0000000000 --- a/packages/expo-cli/e2e/__tests__/__snapshots__/export-test.ts.snap +++ /dev/null @@ -1,99 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`EXPO_USE_EXOTIC=false exports the project for a self-hosted production deployment 1`] = ` -Array [ - "dist/android-index.json (672 B)", - "dist/assetmap.json (size ignored)", - "dist/assets (dir)", - "dist/bundles (dir)", - "dist/bundles/android-XXX.js (845 kB)", - "dist/bundles/ios-XXX.js (844 kB)", - "dist/ios-index.json (656 B)", -] -`; - -exports[`EXPO_USE_EXOTIC=false exports the project for a self-hosted production deployment: android-index 1`] = ` -Object { - "android": Object { - "package": "com.example.minimal", - }, - "assetUrlOverride": "./assets", - "bundleUrl": Any, - "commitTime": Any, - "currentFullName": "@anonymous/basic", - "dependencies": Array [ - "expo", - "react", - "react-native", - ], - "id": "@anonymous/basic", - "ios": Object { - "bundleIdentifier": "com.example.minimal", - }, - "locales": Object {}, - "name": "basic", - "originalFullName": "@anonymous/basic", - "platform": "android", - "platforms": Array [ - "ios", - "android", - ], - "publishedTime": Any, - "releaseId": Any, - "revisionId": Any, - "sdkVersion": "43.0.0", - "slug": "basic", - "version": "1.0.0", -} -`; - -exports[`EXPO_USE_EXOTIC=false exports the project for a self-hosted production deployment: assetmap 1`] = `Object {}`; - -exports[`EXPO_USE_EXOTIC=true exports the project for a self-hosted production deployment 1`] = ` -Array [ - "dist/android-index.json (672 B)", - "dist/assetmap.json (size ignored)", - "dist/assets (dir)", - "dist/bundles (dir)", - "dist/bundles/android-XXX.js (845 kB)", - "dist/bundles/ios-XXX.js (844 kB)", - "dist/ios-index.json (656 B)", -] -`; - -exports[`EXPO_USE_EXOTIC=true exports the project for a self-hosted production deployment: android-index 1`] = ` -Object { - "android": Object { - "package": "com.example.minimal", - }, - "assetUrlOverride": "./assets", - "bundleUrl": Any, - "commitTime": Any, - "currentFullName": "@anonymous/basic", - "dependencies": Array [ - "expo", - "react", - "react-native", - ], - "id": "@anonymous/basic", - "ios": Object { - "bundleIdentifier": "com.example.minimal", - }, - "locales": Object {}, - "name": "basic", - "originalFullName": "@anonymous/basic", - "platform": "android", - "platforms": Array [ - "ios", - "android", - ], - "publishedTime": Any, - "releaseId": Any, - "revisionId": Any, - "sdkVersion": "43.0.0", - "slug": "basic", - "version": "1.0.0", -} -`; - -exports[`EXPO_USE_EXOTIC=true exports the project for a self-hosted production deployment: assetmap 1`] = `Object {}`; diff --git a/packages/expo-cli/e2e/__tests__/export-test.ts b/packages/expo-cli/e2e/__tests__/export-test.ts index d0b6c4a2d7..91caf5fbc4 100644 --- a/packages/expo-cli/e2e/__tests__/export-test.ts +++ b/packages/expo-cli/e2e/__tests__/export-test.ts @@ -48,22 +48,21 @@ for (const isExotic of [false, true]) { const distPath = path.join(projectRoot, 'dist'); const assetMap = JsonFile.read(path.join(distPath, 'assetmap.json')); - expect(deepRelativizePaths(projectRoot, assetMap)).toMatchSnapshot({}, 'assetmap'); + expect(deepRelativizePaths(projectRoot, assetMap)).toEqual({}); const androidIndex = JsonFile.read(path.join(distPath, 'android-index.json')); expect(androidIndex.bundleUrl).toMatch( /^https:\/\/example.com\/export-test-app\/bundles\/android-[\w\d]+\.js$/ ); - expect(androidIndex).toMatchSnapshot( - { + expect(androidIndex).toEqual( + expect.objectContaining({ bundleUrl: expect.any(String), commitTime: expect.any(String), publishedTime: expect.any(String), releaseId: expect.any(String), revisionId: expect.any(String), - }, - 'android-index' + }) ); // List output files with sizes for snapshotting. @@ -82,7 +81,17 @@ for (const isExotic of [false, true]) { return `${path.posix.relative(projectRoot, entry.path)} (${formatFileSize(entry)})`; }); - expect(distFiles).toMatchSnapshot(); + expect(distFiles).toEqual( + expect.arrayContaining([ + expect.stringContaining('dist/android-index.json '), + expect.stringContaining('dist/assetmap.json '), + expect.stringContaining('dist/assets (dir)'), + expect.stringContaining('dist/bundles (dir)'), + expect.stringContaining('dist/bundles/android-XXX.js '), + expect.stringContaining('dist/bundles/ios-XXX.js '), + expect.stringContaining('dist/ios-index.json '), + ]) + ); }); }); }