25 lines
521 B
TypeScript
25 lines
521 B
TypeScript
var _last_title = "";
|
|
|
|
// Test block, containing one or more it() calls.
|
|
export function describe(
|
|
title: string | { new (...args: any[]): any } | Function,
|
|
body: Function,
|
|
) {
|
|
switch (typeof title) {
|
|
case "string": {
|
|
_last_title = title;
|
|
break;
|
|
}
|
|
case "function": {
|
|
_last_title = title.name;
|
|
break;
|
|
}
|
|
}
|
|
body();
|
|
}
|
|
|
|
// Single test.
|
|
export function it(title: string, body: () => void | Promise<void>) {
|
|
Deno.test(_last_title ? `${_last_title} ${title}` : title, body);
|
|
}
|