-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81aea2e
commit 3e6e1ba
Showing
3 changed files
with
41 additions
and
40 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
} | ||
}); |
21 changes: 21 additions & 0 deletions
21
packages/installer/test/unit/release/isSemverRange.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
}); |