Separate parser and helpers from Password class for better testability

This commit is contained in:
Danny Moesch 2018-11-11 18:09:52 +01:00 committed by Bob Sun
parent 2abbceb2e9
commit 7c12263458
17 changed files with 913 additions and 537 deletions

View file

@ -0,0 +1,31 @@
//
// ConstantsTest.swift
// passKitTests
//
// Created by Danny Moesch on 30.09.18.
// Copyright © 2018 Bob Sun. All rights reserved.
//
import XCTest
@testable import passKit
class ConstantsTest: XCTestCase {
func testIsOtpRelated() {
XCTAssertTrue(Constants.isOtpRelated(line: "otpauth://something"))
XCTAssertTrue(Constants.isOtpRelated(line: "otp_algorithm: algorithm"))
XCTAssertFalse(Constants.isOtpRelated(line: "otp: something"))
XCTAssertFalse(Constants.isOtpRelated(line: "otp"))
}
func testUnknown() {
XCTAssertEqual(Constants.unknown(0), "unknown 0")
XCTAssertEqual(Constants.unknown(10), "unknown 10")
}
func testGetSeparator() {
XCTAssertEqual(Constants.getSeparator(breakingLines: true), "\n")
XCTAssertEqual(Constants.getSeparator(breakingLines: false), " ")
}
}