Zum Inhalt

apple/PhysarumApp/Tests/PresetReorderTests.swift

import XCTest
@testable import Physarum

final class PresetReorderTests: XCTestCase {
    func testMoveUpSwapsWithPrevious() {
        XCTAssertEqual(reorderedIDs(["a", "b", "c"], moving: "b", up: true), ["b", "a", "c"])
    }
    func testMoveDownSwapsWithNext() {
        XCTAssertEqual(reorderedIDs(["a", "b", "c"], moving: "b", up: false), ["a", "c", "b"])
    }
    func testMoveUpAtTopIsNoOp() {
        XCTAssertEqual(reorderedIDs(["a", "b", "c"], moving: "a", up: true), ["a", "b", "c"])
    }
    func testMoveDownAtBottomIsNoOp() {
        XCTAssertEqual(reorderedIDs(["a", "b", "c"], moving: "c", up: false), ["a", "b", "c"])
    }
    func testUnknownIdIsNoOp() {
        XCTAssertEqual(reorderedIDs(["a", "b"], moving: "z", up: true), ["a", "b"])
    }
}