mirror of
https://github.com/encounter/JSONAPI.git
synced 2026-07-10 12:18:40 -07:00
36 lines
721 B
Swift
36 lines
721 B
Swift
//
|
|
// Id+LiteralTests.swift
|
|
// JSONAPITests
|
|
//
|
|
// Created by Mathew Polzin on 11/27/18.
|
|
//
|
|
|
|
import XCTest
|
|
import JSONAPI
|
|
import JSONAPITesting
|
|
|
|
extension Int: RawIdType {}
|
|
|
|
class Id_LiteralTests: XCTestCase {
|
|
|
|
func test_StringLiteral() {
|
|
XCTAssertEqual(Id<String, TestEntity>(rawValue: "hello"), "hello")
|
|
}
|
|
|
|
func test_IntegerLiteral() {
|
|
XCTAssertEqual(Id<Int, TestEntity>(rawValue: 121), 121)
|
|
}
|
|
}
|
|
|
|
// MARK: - Test types
|
|
extension Id_LiteralTests {
|
|
enum TestDescription: ResourceObjectDescription {
|
|
public static var jsonType: String { return "test" }
|
|
|
|
public typealias Attributes = NoAttributes
|
|
public typealias Relationships = NoRelationships
|
|
}
|
|
|
|
typealias TestEntity = BasicEntity<TestDescription>
|
|
}
|