diff --git a/packages/dappmanager/test/unit/utils/validate.test.ts b/packages/dappmanager/test/unit/utils/validate.test.ts deleted file mode 100644 index 5e91b117e..000000000 --- a/packages/dappmanager/test/unit/utils/validate.test.ts +++ /dev/null @@ -1,40 +0,0 @@ -import "mocha"; -import { expect } from "chai"; -import { mockHash } from "../../testUtils.js"; -import { isIpfsHash, isSemverRange } from "../../../src/utils/validate.js"; - -describe("Util > validate", () => { - describe("isIpfsHash", () => { - const validHashes = [ - mockHash, - "/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme", - "QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme", - "/ipfs/QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB", - "QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB" - ]; - - for (const hash of validHashes) { - it(`valid hash ${hash}`, () => { - expect(isIpfsHash(hash)).to.equal(true); - }); - } - }); - - describe("isSemverRange", () => { - it("should return true for a regular semver", () => { - expect(isSemverRange("0.1.2")).to.equal(true); - }); - it("should return true for a '*' semver", () => { - expect(isSemverRange("*")).to.equal(true); - }); - it("should return true for a semver range", () => { - expect(isSemverRange("^0.1.2")).to.equal(true); - }); - it("should return false for an IPFS range", () => { - expect(isSemverRange("/ipfs/Qmasbjdbkajbdkjwbkjfbakjsf")).to.equal(false); - }); - it("should return false for random nonsense", () => { - expect(isSemverRange("asjd")).to.equal(false); - }); - }); -}); diff --git a/packages/installer/test/unit/installer/isIpfsHash.test.ts b/packages/installer/test/unit/installer/isIpfsHash.test.ts new file mode 100644 index 000000000..81a54f5a8 --- /dev/null +++ b/packages/installer/test/unit/installer/isIpfsHash.test.ts @@ -0,0 +1,20 @@ +import "mocha"; +import { expect } from "chai"; +import { mockHash } from "../../testUtils.js"; +import { isIpfsHash } from "../../../src/utils.js"; + +describe("isIpfsHash", () => { + const validHashes = [ + mockHash, + "/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme", + "QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme", + "/ipfs/QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB", + "QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB", + ]; + + for (const hash of validHashes) { + it(`valid hash ${hash}`, () => { + expect(isIpfsHash(hash)).to.equal(true); + }); + } +}); diff --git a/packages/installer/test/unit/release/isSemverRange.test.ts b/packages/installer/test/unit/release/isSemverRange.test.ts new file mode 100644 index 000000000..e29a1435d --- /dev/null +++ b/packages/installer/test/unit/release/isSemverRange.test.ts @@ -0,0 +1,21 @@ +import "mocha"; +import { expect } from "chai"; +import { isSemverRange } from "../../../src/release/validate.js"; + +describe("isSemverRange", () => { + it("should return true for a regular semver", () => { + expect(isSemverRange("0.1.2")).to.equal(true); + }); + it("should return true for a '*' semver", () => { + expect(isSemverRange("*")).to.equal(true); + }); + it("should return true for a semver range", () => { + expect(isSemverRange("^0.1.2")).to.equal(true); + }); + it("should return false for an IPFS range", () => { + expect(isSemverRange("/ipfs/Qmasbjdbkajbdkjwbkjfbakjsf")).to.equal(false); + }); + it("should return false for random nonsense", () => { + expect(isSemverRange("asjd")).to.equal(false); + }); +});