Skip to content

Instantly share code, notes, and snippets.

@crookse
Created November 22, 2019 11:27
Show Gist options
  • Save crookse/ed2d78fdd1b1a3a24ac98972b6ab5687 to your computer and use it in GitHub Desktop.
Save crookse/ed2d78fdd1b1a3a24ac98972b6ab5687 to your computer and use it in GitHub Desktop.
Deno Standard Modules - Testing: Basic Usage
import { runTests, test } from "https://deno.land/std/testing/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
// Write a named test where the "name" field's value is the name of the test
// (The name of this test is "testing example")
test({
name: "testing example",
fn(): void {
assertEquals("world", "world");
assertEquals({ hello: "world" }, { hello: "world" });
}
});
// Write a named test where the name of the function is the name of the test
// (The name of this test is "example")
test(function example(): void {
assertEquals("world", "world");
assertEquals({ hello: "world" }, { hello: "world" });
});
runTests();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment