Skip to content

Commit

Permalink
Simplified mock json and fix tests (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldavidw authored Aug 9, 2024
1 parent 5dae63b commit 3b721ad
Showing 1 changed file with 2 additions and 254 deletions.
256 changes: 2 additions & 254 deletions ChronosTests/Import/2FAS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ final class TwoFASTests: XCTestCase {
"schemaVersion": 4,
"services": [
[
"icon": [
"iconCollection": [
"id": "90CAF674-4269-4193-9749-4849F97CFB53",
],
"label": [
"backgroundColor": "Orange",
"text": "AP",
],
"selected": "IconCollection",
],
"name": "Apple",
"order": [
"position": 0,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA1",
Expand All @@ -42,20 +28,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Brown",
"text": "AW",
],
"selected": "Label",
],
"name": "AWS",
"order": [
"position": 1,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA256",
Expand All @@ -71,20 +43,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Indigo",
"text": "PG",
],
"selected": "Label",
],
"name": "PG",
"order": [
"position": 2,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA512",
Expand All @@ -100,20 +58,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Gray",
"text": "UN",
],
"selected": "Label",
],
"name": "Unknown",
"order": [
"position": 3,
],
"otp": [
"account": "",
"algorithm": "SHA1",
Expand All @@ -129,20 +73,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "90CAF674-4269-4193-9749-4849F97CFB53",
],
"label": [
"backgroundColor": "Yellow",
"text": "YU",
],
"selected": "IconCollection",
],
"name": "Yubi",
"order": [
"position": 4,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA1",
Expand All @@ -158,20 +88,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Red",
"text": "HE",
],
"selected": "Label",
],
"name": "Hene",
"order": [
"position": 5,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA256",
Expand All @@ -187,20 +103,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Blue",
"text": "NA",
],
"selected": "Label",
],
"name": "Nath",
"order": [
"position": 6,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA512",
Expand All @@ -216,20 +118,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Green",
"text": "UN",
],
"selected": "Label",
],
"name": "Unknown",
"order": [
"position": 7,
],
"otp": [
"account": "",
"algorithm": "SHA1",
Expand All @@ -245,20 +133,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Green",
"text": "UN",
],
"selected": "Label",
],
"name": "Unknown",
"order": [
"position": 7,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA1",
Expand All @@ -268,7 +142,7 @@ final class TwoFASTests: XCTestCase {
"source": "manual",
"tokenType": "HOTP",
],
"secret": "KQOZTMLOJBSMYWIO4BG4UTXDSR",
"secret": "BB6B7FAYHW2G42ZA4FJHLRWWHU",
"serviceTypeID": "3cb83fc3-8e25-4df5-bdde-1f35611c1d0a",
"updatedAt": 1_721_919_046_000,
],
Expand All @@ -278,7 +152,7 @@ final class TwoFASTests: XCTestCase {
let importService = ImportService()
let tokens = importService.importFromTwoFAS(json: json)!

XCTAssertEqual(tokens.count, 8)
XCTAssertEqual(tokens.count, 9)

XCTAssertEqual(tokens[0].digits, 6)
XCTAssertEqual(tokens[0].type, TokenTypeEnum.TOTP)
Expand Down Expand Up @@ -363,20 +237,6 @@ final class TwoFASTests: XCTestCase {
"schemaVersion": 4,
"services": [
[
"icon": [
"iconCollection": [
"id": "90CAF674-4269-4193-9749-4849F97CFB53",
],
"label": [
"backgroundColor": "Orange",
"text": "AP",
],
"selected": "IconCollection",
],
"name": "Apple",
"order": [
"position": 0,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA1",
Expand All @@ -392,20 +252,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Brown",
"text": "AW",
],
"selected": "Label",
],
"name": "AWS",
"order": [
"position": 1,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA256",
Expand All @@ -421,20 +267,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Indigo",
"text": "PG",
],
"selected": "Label",
],
"name": "PG",
"order": [
"position": 2,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA512",
Expand All @@ -450,20 +282,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Gray",
"text": "UN",
],
"selected": "Label",
],
"name": "Unknown",
"order": [
"position": 3,
],
"otp": [
"account": "",
"algorithm": "SHA1",
Expand Down Expand Up @@ -529,20 +347,6 @@ final class TwoFASTests: XCTestCase {
"schemaVersion": 4,
"services": [
[
"icon": [
"iconCollection": [
"id": "90CAF674-4269-4193-9749-4849F97CFB53",
],
"label": [
"backgroundColor": "Orange",
"text": "AP",
],
"selected": "IconCollection",
],
"name": "Apple",
"order": [
"position": 0,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA1",
Expand All @@ -558,20 +362,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Brown",
"text": "AW",
],
"selected": "Label",
],
"name": "AWS",
"order": [
"position": 1,
],
"otp": [
"account": "[email protected]",
"algorithm": "MD5",
Expand All @@ -587,20 +377,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Indigo",
"text": "PG",
],
"selected": "Label",
],
"name": "PG",
"order": [
"position": 2,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA224",
Expand All @@ -616,20 +392,6 @@ final class TwoFASTests: XCTestCase {
"updatedAt": 1_721_919_046_000,
],
[
"icon": [
"iconCollection": [
"id": "A5B3FB65-4EC5-43E6-8EC1-49E24CA9E7AD",
],
"label": [
"backgroundColor": "Indigo",
"text": "PG",
],
"selected": "Label",
],
"name": "PG",
"order": [
"position": 2,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA334",
Expand Down Expand Up @@ -663,20 +425,6 @@ final class TwoFASTests: XCTestCase {
"schemaVersion": 4,
"services": [
[
"icon": [
"iconCollection": [
"id": "90CAF674-4269-4193-9749-4849F97CFB53",
],
"label": [
"backgroundColor": "Orange",
"text": "AP",
],
"selected": "IconCollection",
],
"name": "Apple",
"order": [
"position": 0,
],
"otp": [
"account": "[email protected]",
"algorithm": "SHA1",
Expand Down

0 comments on commit 3b721ad

Please sign in to comment.