-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic tests and simplify some code, make some api private
- Loading branch information
v1rtl
committed
Nov 7, 2022
1 parent
296ea44
commit 7bd3bd1
Showing
6 changed files
with
47 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
coverage* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { lazyJSONParse, pathsAreEqual } from './utils.ts' | ||
import { assertEquals } from 'https://deno.land/std@0.162.0/testing/asserts.ts' | ||
|
||
Deno.test('lazyJSONParse', async (it) => { | ||
await it.step('should parse JSON like JSON.parse', () => { | ||
assertEquals(lazyJSONParse('{ "a": "b" }'), JSON.parse('{ "a": "b" }')) | ||
}) | ||
await it.step('should return an empty object on failed parse', () => { | ||
assertEquals(lazyJSONParse('{ "a": "b"'), {}) | ||
}) | ||
}) | ||
|
||
Deno.test('pathsAreEqual', async (it) => { | ||
await it.step('if expected path is asterisk, return true', () => { | ||
assertEquals(pathsAreEqual('/hello', '*'), true) | ||
}) | ||
await it.step('should assert equal paths', () => { | ||
assertEquals(pathsAreEqual('/hello', '/hello'), true) | ||
}) | ||
await it.step('if nothing is expected, default to "/"', () => { | ||
assertEquals(pathsAreEqual('/'), true) | ||
}) | ||
}) |