Skip to content

Commit 6ffb608

Browse files
committed
test(types): initial version
1 parent 98fff9b commit 6ffb608

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

index.test-d.ts

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { expectType } from "tsd";
2+
import { request } from "@octokit/request";
3+
4+
import { verify } from "./index.js";
5+
6+
const rawBody = "";
7+
const signature = "";
8+
const keyId = "";
9+
const token = "";
10+
11+
export async function verifyTest() {
12+
const result = await verify(rawBody, signature, keyId);
13+
expectType<boolean>(result);
14+
15+
// @ts-expect-error - first 3 arguments are required
16+
verify(rawBody, signature);
17+
18+
// @ts-expect-error - rawBody must be a string
19+
await verify(1, signature, keyId);
20+
21+
// @ts-expect-error - signature must be a string
22+
await verify(rawBody, 1, keyId);
23+
24+
// @ts-expect-error - keyId must be a string
25+
await verify(rawBody, signature, 1);
26+
27+
// accepts a token argument
28+
await verify(rawBody, signature, keyId, { token });
29+
30+
// accepts a request argument
31+
await verify(rawBody, signature, keyId, { request });
32+
}

0 commit comments

Comments
 (0)