-
Notifications
You must be signed in to change notification settings - Fork 554
Expand file tree
/
Copy pathMimeTypesTests.swift
More file actions
39 lines (32 loc) · 1.4 KB
/
MimeTypesTests.swift
File metadata and controls
39 lines (32 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// MimeTypesTests.swift
// Swifter
//
// Created by Daniel Große on 06.03.18.
// Copyright © 2018 Damian Kołakowski. All rights reserved.
//
import XCTest
class MimeTypeTests: XCTestCase {
func testTypeExtension() {
XCTAssertNotNil(String.mimeType, "Type String is extended with mimeType")
XCTAssertNotNil(NSURL.mimeType, "Type NSURL is extended with mimeType")
XCTAssertNotNil(NSString.mimeType, "Type NSString is extended with mimeType")
}
func testDefaultValue() {
XCTAssertEqual("file.null".mimeType(), "application/octet-stream")
}
func testCorrectTypes() {
XCTAssertEqual("file.html".mimeType(), "text/html")
XCTAssertEqual("file.css".mimeType(), "text/css")
XCTAssertEqual("file.mp4".mimeType(), "video/mp4")
XCTAssertEqual("file.pptx".mimeType(), "application/vnd.openxmlformats-officedocument.presentationml.presentation")
XCTAssertEqual("file.war".mimeType(), "application/java-archive")
}
func testCaseInsensitivity() {
XCTAssertEqual("file.HTML".mimeType(), "text/html")
XCTAssertEqual("file.cSs".mimeType(), "text/css")
XCTAssertEqual("file.MP4".mimeType(), "video/mp4")
XCTAssertEqual("file.PPTX".mimeType(), "application/vnd.openxmlformats-officedocument.presentationml.presentation")
XCTAssertEqual("FILE.WAR".mimeType(), "application/java-archive")
}
}