From 8b3d1223be80a16b1a9f219548873a64e6ab7358 Mon Sep 17 00:00:00 2001 From: Simon Whitty Date: Tue, 24 Oct 2023 21:10:21 +1100 Subject: [PATCH] FileHTTPHandler test --- FlyingFox/Tests/Handlers/HTTPHandlerTests.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/FlyingFox/Tests/Handlers/HTTPHandlerTests.swift b/FlyingFox/Tests/Handlers/HTTPHandlerTests.swift index 2f2ab1f8..63ad0fc4 100644 --- a/FlyingFox/Tests/Handlers/HTTPHandlerTests.swift +++ b/FlyingFox/Tests/Handlers/HTTPHandlerTests.swift @@ -100,6 +100,13 @@ final class HTTPHandlerTests: XCTestCase { XCTAssertEqual(response.statusCode, .notFound) } + func testFileHandler_Returns404WhenPathDoesNotExist() async throws { + let handler = FileHTTPHandler(path: URL(fileURLWithPath: "unknown"), contentType: "chips") + + let response = try await handler.handleRequest(.make()) + XCTAssertEqual(response.statusCode, .notFound) + } + func testFileHandler_DetectsCorrectContentType() { XCTAssertEqual( FileHTTPHandler.makeContentType(for: "fish.json"),