Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
keroxp authored Feb 14, 2020
1 parent 9b91b43 commit 27badee
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .denov
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.32.0
v0.33.0
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
run: |
export PATH=$HOME/.local/bin:$PATH
sleep 10
deno -A couch_test.ts
deno test -A couch_test.ts
29 changes: 11 additions & 18 deletions couch_test.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import { runIfMain, test } from "./vendor/https/deno.land/std/testing/mod.ts";
import { CouchClient } from "./couch.ts";
import {
assert,
assertEquals
} from "./vendor/https/deno.land/std/testing/asserts.ts";
import open = Deno.open;
const { test } = Deno;

const kDbName = "testdb";
const env = Deno.env();
const endpoint = env["COUCHDB_ENDPOINT"] || "http://127.0.0.1:5984";
const client = new CouchClient(endpoint);
const db = client.database(kDbName);

async function beforeAll() {
if (await client.databaseExists(kDbName)) {
await client.deleteDatabase(kDbName);
}
await client.createDatabase(kDbName);
}

async function afterAll() {
await client.deleteDatabase(kDbName);
}

async function useDatabase(f: (db: string) => Promise<unknown>) {
const name = "testdb-" + Math.round(Math.random() * 10000000);
Expand All @@ -35,6 +25,12 @@ async function useDatabase(f: (db: string) => Promise<unknown>) {
}
});
}
test("beforeAll", async () => {
if (await client.databaseExists(kDbName)) {
await client.deleteDatabase(kDbName);
}
await client.createDatabase(kDbName);
});

test(async function metadata() {
const data = await client.metadata();
Expand Down Expand Up @@ -206,10 +202,7 @@ test(async function deleteAttachment() {
assertEquals(res, void 0);
});

beforeAll()
.then(() =>
runIfMain(import.meta, {
parallel: true
})
)
.then(afterAll);
test("afterAll", async () => {
await client.deleteDatabase(kDbName);
});

3 changes: 1 addition & 2 deletions modules-lock.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"https://deno.land/std": {
"version": "@v0.32.0",
"version": "@v0.33.0",
"modules": [
"/testing/mod.ts",
"/testing/asserts.ts"
]
}
Expand Down
4 changes: 2 additions & 2 deletions modules.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"https://deno.land/std": {
"version": "@v0.32.0",
"modules": ["/testing/mod.ts", "/testing/asserts.ts"]
"version": "@v0.33.0",
"modules": ["/testing/asserts.ts"]
}
}
2 changes: 1 addition & 1 deletion vendor/https/deno.land/std/testing/asserts.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "https://deno.land/std@v0.32.0/testing/asserts.ts";
export * from "https://deno.land/std@v0.33.0/testing/asserts.ts";
1 change: 0 additions & 1 deletion vendor/https/deno.land/std/testing/mod.ts

This file was deleted.

0 comments on commit 27badee

Please sign in to comment.