buildkite-swift/Tests/BuildkiteTests/Resources/REST/OrganizationsTests.swift

54 lines
1.3 KiB
Swift

//
// OrganizationsTests.swift
// Buildkite
//
// Created by Aaron Sky on 5/4/20.
// Copyright © 2020 Aaron Sky. All rights reserved.
//
import Foundation
import XCTest
@testable import Buildkite
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
extension Organization {
init() {
self.init(
id: UUID(),
graphqlId: "",
url: Followable(),
webURL: URL(),
name: "Buildkite",
slug: "buildkite",
pipelinesURL: Followable(),
agentsURL: Followable(),
emojisURL: Followable(),
createdAt: Date(timeIntervalSince1970: 1000)
)
}
}
class OrganizationsTests: XCTestCase {
func testOrganizationsList() async throws {
let expected = [Organization()]
let context = try MockContext(content: expected)
let response = try await context.client.send(.organizations)
XCTAssertEqual(expected, response.content)
}
func testOrganizationsGet() async throws {
let expected = Organization()
let context = try MockContext(content: expected)
let response = try await context.client.send(.organization("buildkite"))
XCTAssertEqual(expected, response.content)
}
}