Skip to content

Commit 012dba3

Browse files
committed
wip(trusted-publishing): capture rule about targeting the official registry
for #958
1 parent b674034 commit 012dba3

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { OFFICIAL_REGISTRY } from "../definitions/constants.js";
2+
3+
export default function oidcContextEstablished(registry) {
4+
return OFFICIAL_REGISTRY === registry;
5+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import test from "ava";
2+
3+
import { OFFICIAL_REGISTRY } from "../../lib/definitions/constants.js";
4+
import oidcContextEstablished from "../../lib/trusted-publishing/oidc-context.js";
5+
6+
test("that `true` is returned when a trusted-publishing context has been established with the official registry", async (t) => {
7+
t.true(await oidcContextEstablished(OFFICIAL_REGISTRY));
8+
});
9+
10+
test("that `false` is returned when a custom registry is targeted", async (t) => {
11+
t.false(await oidcContextEstablished("https://custom.registry.org/"));
12+
});

0 commit comments

Comments
 (0)