diff --git a/packages/core/src/extensions/__tests__/lens-extension.test.ts b/packages/core/src/extensions/__tests__/lens-extension.test.ts index 13462fc10d..ef3c60a7f2 100644 --- a/packages/core/src/extensions/__tests__/lens-extension.test.ts +++ b/packages/core/src/extensions/__tests__/lens-extension.test.ts @@ -18,7 +18,6 @@ describe("lens extension", () => { name: "foo-bar", version: "0.1.1", engines: { lens: "^5.5.0" }, - storeName: "foo-bar-store", }, id: "/this/is/fake/package.json", absolutePath: "/absolute/fake/", @@ -37,7 +36,56 @@ describe("lens extension", () => { describe("storeName", () => { it("returns storeName", () => { - expect(ext.storeName).toBe("foo-bar-store"); + expect(ext.storeName).not.toBeDefined(); + }); + }); + + describe("id", () => { + it("returns id", () => { + expect(ext.id).toBe("/this/is/fake/package.json"); + }); + }); + + describe("storeLocation", () => { + it("returns storeLocation", () => { + expect(ext.storeLocation).toBe("foo-bar"); + }); + }); +}); + +describe("lens extension with storeName", () => { + beforeEach(async () => { + ext = new LensExtension({ + manifest: { + name: "@lensapp/foo-bar", + storeName: "/test/foo-bar", + version: "0.1.1", + engines: { lens: "^5.5.0" }, + }, + id: "/this/is/fake/extension", + absolutePath: "/absolute/fake/", + manifestPath: "/this/is/fake/package.json", + isBundled: false, + isEnabled: true, + isCompatible: true, + }); + }); + + describe("storeName", () => { + it("returns storeName", () => { + expect(ext.storeName).toBe("/test/foo-bar"); + }); + }); + + describe("id", () => { + it("derives id from storeName", () => { + expect(ext.id).toBe("/test/foo-bar"); + }); + }); + + describe("storeLocation", () => { + it("derives storeLocation from storeName", () => { + expect(ext.storeLocation).toBe("/test/foo-bar"); }); }); }); diff --git a/packages/core/src/extensions/lens-extension.ts b/packages/core/src/extensions/lens-extension.ts index b59c996e32..1850cdb2c6 100644 --- a/packages/core/src/extensions/lens-extension.ts +++ b/packages/core/src/extensions/lens-extension.ts @@ -63,7 +63,7 @@ export class LensExtension< constructor({ id, manifest, manifestPath, isBundled }: InstalledExtension) { makeObservable(this); - this.id = id; + this.id = manifest.storeName || id; this.manifest = manifest; this.manifestPath = manifestPath; this.isBundled = !!isBundled; @@ -83,10 +83,6 @@ export class LensExtension< get storeName() { return this.manifest.storeName; - } - - get dataLocation() { - return this.storeName || this.id; } get storeLocation() { @@ -106,7 +102,7 @@ export class LensExtension< * folder name. */ async getExtensionFileFolder(): Promise { - return this[lensExtensionDependencies].fileSystemProvisionerStore.requestDirectory(this.dataLocation); + return this[lensExtensionDependencies].fileSystemProvisionerStore.requestDirectory(this.id); } @action