Skip to content

Commit

Permalink
fileInfo.mode is now available on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k committed Nov 13, 2024
1 parent bec44b1 commit 905e458
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions http/file_server_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,7 @@ Deno.test("serveDir() serves directory index", async () => {
assertStringIncludes(page, '<a href="/hello.html">hello.html</a>');
assertStringIncludes(page, '<a href="/tls/">tls/</a>');
assertStringIncludes(page, "%2525A.txt");
// `Deno.FileInfo` is not completely compatible with Windows yet
// TODO(bartlomieju): `mode` should work correctly in the future.
// Correct this test case accordingly.
if (Deno.build.os === "windows") {
assertMatch(page, /<td class="mode">(\s)*\(unknown mode\)(\s)*<\/td>/);
} else {
assertMatch(page, /<td class="mode">(\s)*[a-zA-Z- ]{14}(\s)*<\/td>/);
}
assertMatch(page, /<td class="mode">(\s)*[a-zA-Z- ]{14}(\s)*<\/td>/);

await Deno.remove(filePath);
});
Expand All @@ -212,14 +205,7 @@ Deno.test("serveDir() serves directory index with file containing space in the f
assertStringIncludes(page, '<a href="/hello.html">hello.html</a>');
assertStringIncludes(page, '<a href="/tls/">tls/</a>');
assertStringIncludes(page, "test%20file.txt");
// `Deno.FileInfo` is not completely compatible with Windows yet
// TODO(bartlomieju): `mode` should work correctly in the future.
// Correct this test case accordingly.
if (Deno.build.os === "windows") {
assertMatch(page, /<td class="mode">(\s)*\(unknown mode\)(\s)*<\/td>/);
} else {
assertMatch(page, /<td class="mode">(\s)*[a-zA-Z- ]{14}(\s)*<\/td>/);
}
assertMatch(page, /<td class="mode">(\s)*[a-zA-Z- ]{14}(\s)*<\/td>/);

await Deno.remove(filePath);
});
Expand Down

0 comments on commit 905e458

Please sign in to comment.