Skip to content

Commit 29db378

Browse files
test: add functional tests
1 parent b78da7f commit 29db378

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/result.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ describe("#result() FT", () => {
128128
["date", "repo", "scorecard", "score", "checks"].sort()
129129
);
130130
});
131+
132+
it("should throw when given a package and npm resolve is falsy", async() => {
133+
assert.rejects(async() => scorecard.result("@unknown-package/for-sure", { resolveOnNpmRegistry: false }), {
134+
name: "Error",
135+
message: "Invalid repository, cannot find it on GitHub"
136+
});
137+
});
138+
139+
it("should throw when given an unknown npm package", async() => {
140+
assert.rejects(async() => await scorecard.result("@unknown-package/for-sure", { resolveOnNpmRegistry: true }), {
141+
name: "Error",
142+
message: "Invalid repository, cannot find it on GitHub or NPM registry"
143+
});
144+
});
131145
});
132146

133147
function getPath(repository: string): string {

0 commit comments

Comments
 (0)