From 117ddb2ccb11fe6708b80c6c779eccdaed7fc18a Mon Sep 17 00:00:00 2001 From: Ramon Brullo Date: Fri, 1 Nov 2024 10:25:25 +0100 Subject: [PATCH] test: fix broken e2e test --- .../verdaccio/com.example.demo/v1.0.0/package.json | 4 ---- .../verdaccio/com.example.demo/v2.0.0/package.json | 4 ---- .../com.unity.mathematics/v1.0.0/package.json | 4 ++++ test/e2e/add.test.ts | 12 +++++++----- test/e2e/setup/test-registry.ts | 6 ++++++ 5 files changed, 17 insertions(+), 13 deletions(-) delete mode 100644 .github/verdaccio/com.example.demo/v1.0.0/package.json delete mode 100644 .github/verdaccio/com.example.demo/v2.0.0/package.json create mode 100644 .github/verdaccio/com.unity.mathematics/v1.0.0/package.json create mode 100644 test/e2e/setup/test-registry.ts diff --git a/.github/verdaccio/com.example.demo/v1.0.0/package.json b/.github/verdaccio/com.example.demo/v1.0.0/package.json deleted file mode 100644 index 9424fb88..00000000 --- a/.github/verdaccio/com.example.demo/v1.0.0/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "com.example.demo", - "version": "1.0.0" -} \ No newline at end of file diff --git a/.github/verdaccio/com.example.demo/v2.0.0/package.json b/.github/verdaccio/com.example.demo/v2.0.0/package.json deleted file mode 100644 index 55dbdb55..00000000 --- a/.github/verdaccio/com.example.demo/v2.0.0/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "com.example.demo", - "version": "2.0.0" -} \ No newline at end of file diff --git a/.github/verdaccio/com.unity.mathematics/v1.0.0/package.json b/.github/verdaccio/com.unity.mathematics/v1.0.0/package.json new file mode 100644 index 00000000..265d4c91 --- /dev/null +++ b/.github/verdaccio/com.unity.mathematics/v1.0.0/package.json @@ -0,0 +1,4 @@ +{ + "name": "com.unity.mathematics", + "version": "1.0.0" +} \ No newline at end of file diff --git a/test/e2e/add.test.ts b/test/e2e/add.test.ts index 8d24ed17..5deb1b34 100644 --- a/test/e2e/add.test.ts +++ b/test/e2e/add.test.ts @@ -5,6 +5,7 @@ import { getProjectManifest } from "./check/project-manifest"; import { runOpenupm } from "./run"; import { prepareHomeDirectory } from "./setup/directories"; import { prepareUnityProject } from "./setup/project"; +import { testRegistryUrl as e2eTestRegistryUrl } from "./setup/test-registry"; describe("add packages", () => { type SuccessfulAddCase = { @@ -298,13 +299,14 @@ describe("add packages", () => { await testSuccessfulAdd( [ { - packageName: "jp.keijiro.metamesh", - addVersion: "1.2.0", - expectedVersion: "1.2.0", + // The test registry contains the package, but not this version so it should fallback to the Unity registry. + packageName: "com.unity.mathematics", + addVersion: "1.2.1", + expectedVersion: "1.2.1", }, ], - ["jp.keijiro.metamesh"], - RegistryUrl.parse("https://registry.npmjs.com") + [], + e2eTestRegistryUrl ); }); }); diff --git a/test/e2e/setup/test-registry.ts b/test/e2e/setup/test-registry.ts new file mode 100644 index 00000000..bc2d7571 --- /dev/null +++ b/test/e2e/setup/test-registry.ts @@ -0,0 +1,6 @@ +import { RegistryUrl } from "../../../src/domain/registry-url"; + +/** + * Registry url of the local e2e test package registry. + */ +export const testRegistryUrl = RegistryUrl.parse("http://localhost:4873");