-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_test.ts
28 lines (27 loc) · 928 Bytes
/
mod_test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
import { spy, Spy, FakeTime } from "https://deno.land/x/[email protected]/mod.ts";
import { wakeDyno, wakeDynos } from "./mod.ts";
/*
// Waiting for https://github.com/denoland/deno/issues/11133
Deno.test("wake an Heroku application", () => {
const url = "https://kaffeine.herokuapp.com/";
const time: FakeTime = new FakeTime();
const wakeDynoSpy: Spy<void> = spy(wakeDyno);
const logSpy = spy(console, 'log');
const fetchSpy = spy(fetch);
try {
wakeDynoSpy(url, {
interval: .1, // 6sec
});
assertEquals(wakeDynoSpy.calls.length, 1);
assertEquals(fetchSpy.calls.length, 0);
assertEquals(logSpy.calls.length, 0);
time.tick(6000);
assertEquals(logSpy.calls.length, 1);
assertEquals(fetchSpy.calls.length, 1);
} finally {
logSpy.restore();
wakeDynoSpy.restore();
time.restore();
}
});*/