milestone 9: react spa admin ui, frontend ci and embedded dist
This commit is contained in:
+22
-11
@@ -410,21 +410,32 @@ test "dev-mode disk reads refuse a symlink that escapes the root" {
|
||||
try testing.expect(!resolvesUnderRoot(root, io, "missing.txt"));
|
||||
}
|
||||
|
||||
test "the placeholder dist is embedded with its gzip siblings" {
|
||||
test "the embedded dist has an index and consistent gzip siblings" {
|
||||
try testing.expect(embedded.len > 0);
|
||||
|
||||
const index = find(embedded, index_path).?;
|
||||
try testing.expectEqualStrings("text/html; charset=utf-8", index.content_type);
|
||||
try testing.expect(std.mem.containsAtLeast(u8, index.bytes, 1, "nxdns"));
|
||||
try testing.expect(std.mem.containsAtLeast(u8, index.bytes, 1, "/api/health"));
|
||||
try testing.expect(index.bytes.len > 0);
|
||||
|
||||
const favicon = find(embedded, "/favicon.svg").?;
|
||||
try testing.expectEqualStrings("image/svg+xml", favicon.content_type);
|
||||
for (embedded) |file| {
|
||||
try testing.expect(file.etag.len >= 3);
|
||||
try testing.expectEqual(@as(u8, '"'), file.etag[0]);
|
||||
try testing.expectEqual(@as(u8, '"'), file.etag[file.etag.len - 1]);
|
||||
|
||||
const gz = select(embedded, index_path, "gzip").?;
|
||||
try testing.expect(gz.gzip);
|
||||
try testing.expect(gz.file.bytes.len < index.bytes.len);
|
||||
// The gzip member header: build-time compression, not an accident.
|
||||
try testing.expectEqual(@as(u8, 0x1f), gz.file.bytes[0]);
|
||||
try testing.expectEqual(@as(u8, 0x8b), gz.file.bytes[1]);
|
||||
var occurrences: usize = 0;
|
||||
for (embedded) |other| {
|
||||
if (std.mem.eql(u8, other.path, file.path)) occurrences += 1;
|
||||
}
|
||||
try testing.expectEqual(@as(usize, 1), occurrences);
|
||||
|
||||
if (std.mem.endsWith(u8, file.path, ".gz")) {
|
||||
const base = find(embedded, file.path[0 .. file.path.len - 3]).?;
|
||||
try testing.expect(file.bytes.len < base.bytes.len);
|
||||
// The gzip member header: build-time compression, not an accident.
|
||||
try testing.expectEqual(@as(u8, 0x1f), file.bytes[0]);
|
||||
try testing.expectEqual(@as(u8, 0x8b), file.bytes[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test "embedded entries agree with the dev-mode content type map" {
|
||||
|
||||
Reference in New Issue
Block a user