mirror of
https://github.com/denoland/deno.git
synced 2024-12-03 17:08:35 -05:00
31 lines
817 B
Markdown
31 lines
817 B
Markdown
|
# Testing
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
```ts
|
||
|
import { test, assert, equal, assertEqual } from 'https://deno.land/x/testing/testing.ts';
|
||
|
|
||
|
test({
|
||
|
name: 'testing example',
|
||
|
fn() {
|
||
|
assert(equal("world", "world"));
|
||
|
assert(!equal("hello", "world"));
|
||
|
assert(equal({ hello: "world" }, { hello: "world" }));
|
||
|
assert(!equal({ world: "hello" }, { hello: "world" }));
|
||
|
assertEqual("world", "world");
|
||
|
assertEqual({hello: "world"}, {hello: "world"});
|
||
|
},
|
||
|
});
|
||
|
```
|
||
|
|
||
|
Short syntax (named function instead of object):
|
||
|
```ts
|
||
|
test(function example() {
|
||
|
assert(equal("world", "world"));
|
||
|
assert(!equal("hello", "world"));
|
||
|
assert(equal({ hello: "world" }, { hello: "world" }));
|
||
|
assert(!equal({ world: "hello" }, { hello: "world" }));
|
||
|
assertEqual("world", "world");
|
||
|
assertEqual({hello: "world"}, {hello: "world"});
|
||
|
});
|
||
|
```
|