Created
May 10, 2021 20:41
-
-
Save cantremember/759609b4bd8e134c02d2fb6118252ef7 to your computer and use it in GitHub Desktop.
matchURI Test Suite
This file contains hidden or 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
import assert from 'assert'; | |
import { matchURI } from './matchURI.mjs'; | |
assert.deepStrictEqual(matchURI('UNPARSEABLE'), { | |
uri: 'UNPARSEABLE', | |
id: undefined, | |
reason: 'error', | |
}); | |
assert.deepStrictEqual(matchURI('https://stealth.mil/resource/SECRET'), { | |
uri: 'https://stealth.mil/resource/SECRET', | |
id: undefined, | |
reason: 'none', | |
}); | |
assert.deepStrictEqual(matchURI('https://example.com'), { | |
uri: 'https://example.com', | |
id: undefined, | |
reason: 'hostname', | |
}); | |
assert.deepStrictEqual(matchURI('http://alternate.net/resource/RESOURCE/'), { | |
uri: 'http://alternate.net/resource/RESOURCE/', | |
id: 'RESOURCE', | |
reason: 'pathname', | |
}); | |
assert.deepStrictEqual(matchURI('https://example.com/process/resource/query?id=QUERY'), { | |
uri: 'https://example.com/process/resource/query?id=QUERY', | |
id: 'QUERY', | |
reason: 'param', | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment