Skip to content

Commit

Permalink
Update handler.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Oct 19, 2023
1 parent 5cd4fd0 commit 7bb29d4
Showing 1 changed file with 55 additions and 55 deletions.
110 changes: 55 additions & 55 deletions src/request/handler.test.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
import { handler } from "./handler.ts";
// import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
// import { handler } from "./handler.ts";

Deno.test(
'Request specific files and test for correct "Content-Type".',
async (test) => {
await test.step({
ignore: true,
name: 'Directory (no extension)',
fn: () => {
const request = new Request('http://localhost:80/testdir');
// Deno.test(
// 'Request specific files and test for correct "Content-Type".',
// async (test) => {
// await test.step({
// ignore: true,
// name: 'Directory (no extension)',
// fn: () => {
// const request = new Request('http://localhost:80/testdir');

assertEquals(
handler(
request,
'./',
'index.html',
false
).headers.get('Content-Type'),
'text/html'
);
}
});
await test.step({
ignore: true,
name: 'Extension (js)',
fn: () => {
const request = new Request('http://localhost:80/testdir/file.js');
// assertEquals(
// handler(
// request,
// './',
// 'index.html',
// false
// ).headers.get('Content-Type'),
// 'text/html'
// );
// }
// });
// await test.step({
// ignore: true,
// name: 'Extension (js)',
// fn: () => {
// const request = new Request('http://localhost:80/testdir/file.js');

assertEquals(
handler(
request,
'./',
'index.html',
false
).headers.get('Content-Type'),
'application/javascript'
);
}
});
await test.step({
ignore: true,
name: 'Unknown extension',
fn: () => {
const request = new Request('http://localhost:80/testdir/file.unknownExtension');
// assertEquals(
// handler(
// request,
// './',
// 'index.html',
// false
// ).headers.get('Content-Type'),
// 'application/javascript'
// );
// }
// });
// await test.step({
// ignore: true,
// name: 'Unknown extension',
// fn: () => {
// const request = new Request('http://localhost:80/testdir/file.unknownExtension');

assertEquals(
handler(
request,
'./',
'index.html',
false
).headers.get('Content-Type'),
'text/plain'
);
}
});
}
)
// assertEquals(
// handler(
// request,
// './',
// 'index.html',
// false
// ).headers.get('Content-Type'),
// 'text/plain'
// );
// }
// });
// }
// )

0 comments on commit 7bb29d4

Please sign in to comment.