-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Upgrade deno_std to 0.3.4 and update tests. * Travis CI: Upgrade deno to 0.3.7 * Fix formatting * Use release tags for pinning dependencies
- Loading branch information
Showing
5 changed files
with
16 additions
and
11 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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * as http from 'https://deno.land/x/http@61a3911be7e01273e13bf35a3a16285f413f0b70/mod.ts'; | ||
export { Status as status } from 'https://deno.land/x/http@61a3911be7e01273e13bf35a3a16285f413f0b70/http_status.ts'; | ||
export { STATUS_TEXT as statusText } from 'https://deno.land/x/http@61a3911be7e01273e13bf35a3a16285f413f0b70/http_status.ts'; | ||
export * as http from 'https://deno.land/x/http@v0.3.4/server.ts'; | ||
export { Status as status } from 'https://deno.land/x/http@v0.3.4/http_status.ts'; | ||
export { STATUS_TEXT as statusText } from 'https://deno.land/x/http@v0.3.4/http_status.ts'; |
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 |
---|---|---|
@@ -1,34 +1,35 @@ | ||
import { assert, runTests, test } from 'https://deno.land/x/std/testing/mod.ts'; | ||
import { assertEquals, assertStrictEq } from 'https://deno.land/[email protected]/testing/asserts.ts'; | ||
import { runTests, test } from 'https://deno.land/[email protected]/testing/mod.ts'; | ||
import respond from './lib/respond.js'; | ||
|
||
test(async function respondsHtml() { | ||
let called = false; | ||
const fakeRequest = { | ||
respond(config) { | ||
called = true; | ||
assert.equal(config.body, new TextEncoder().encode('hi')); | ||
assert.strictEqual(config.headers.get('Content-Type'), 'text/html; charset=utf-8'); | ||
assertEquals(config.body, new TextEncoder().encode('hi')); | ||
assertStrictEq(config.headers.get('Content-Type'), 'text/html; charset=utf-8'); | ||
} | ||
}; | ||
await respond(fakeRequest, { body : 'hi' }); | ||
assert.strictEqual(called, true); | ||
assertStrictEq(called, true); | ||
}); | ||
|
||
test(async function respondsJson() { | ||
let called = false; | ||
const fakeRequest = { | ||
respond(config) { | ||
called = true; | ||
assert.equal(config.body, new TextEncoder().encode(JSON.stringify({ foo : 'bar' }))); | ||
assert.strictEqual(config.headers.get('Content-Type'), 'application/json; charset=utf-8'); | ||
assertEquals(config.body, new TextEncoder().encode(JSON.stringify({ foo : 'bar' }))); | ||
assertStrictEq(config.headers.get('Content-Type'), 'application/json; charset=utf-8'); | ||
} | ||
}; | ||
await respond(fakeRequest, { | ||
body : { | ||
foo : 'bar' | ||
} | ||
}); | ||
assert.strictEqual(called, true); | ||
assertStrictEq(called, true); | ||
}); | ||
|
||
runTests(); |