Skip to content

Commit

Permalink
test: deno (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Oct 10, 2022
1 parent 567104c commit a59c043
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
types: [opened, synchronize]

jobs:
test:
node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -17,3 +17,11 @@ jobs:
cache: npm
- run: npm ci
- run: npm test
deno: # deno test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- run: deno test --unstable --no-check tests/deno/
35 changes: 35 additions & 0 deletions tests/deno/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// deno-lint-ignore-file

import {
assertInstanceOf,
assertEquals,
} from "https://deno.land/[email protected]/testing/asserts.ts";

import { Octokit } from "npm:@octokit-next/core";

Deno.test("smoke", () => {
const octokit = new Octokit();
assertInstanceOf(octokit.request, Function);
});

Deno.test("request", async () => {
async function mockFetch(url: string, options: any) {
assertEquals(url, "https://api.github.com/");
assertEquals(options.method, "GET");
assertEquals(options.headers.accept, "application/vnd.github.v3+json");

return new Response('{"ok": true}', {
headers: {
"content-type": "application/json",
},
});
}
const octokit = new Octokit({
request: {
fetch: mockFetch,
},
});

const response = await octokit.request("/");
assertEquals(response.data.ok, true);
});

0 comments on commit a59c043

Please sign in to comment.