<commit_before>//
//  PasswordTest.swift
//  passKitTests
//
//  Created by <NAME> on 02.05.18.
//  Copyright © 2018 <NAME>. All rights reserved.
//

import XCTest

@testable import passKit

class PasswordTest: XCTestCase {

    func testUrl() {
        let password = getPasswordObjectWith(content: "")

        XCTAssertEqual(password.url, PASSWORD_URL)
        XCTAssertEqual(password.namePath, PASSWORD_PATH)
    }

    func testEmptyFile() {
        [
            "",
            "\n",
        ].forEach { fileContent in
            let password = getPasswordObjectWith(content: fileContent)

            XCTAssertEqual(password.password, "")
            XCTAssertEqual(password.plainData, fileContent.data(using: .utf8))
            XCTAssertEqual(password.additionsPlainText, "")
            XCTAssertTrue(password.getFilteredAdditions().isEmpty)
            XCTAssertEqual(password.numberOfUnknowns, 0)

            XCTAssertNil(password.username)
            XCTAssertNil(password.urlString)
            XCTAssertNil(password.login)

            XCTAssertEqual(password.numberOfOtpRelated, 0)
        }<commit_msg>Make sure unknowns and OTP fields are not hidden in PasswordTest<commit_after>//
//  PasswordTest.swift
//  passKitTests
//
//  Created by <NAME> on 02.05.18.
//  Copyright © 2018 <NAME>. All rights reserved.
//

import XCTest

@testable import passKit

class PasswordTest: XCTestCase {

    override static func setUp() {
        super.setUp()
        SharedDefaults[.isHideUnknownOn] = false
        SharedDefaults[.isHideOTPOn] = false
    }

    func testUrl() {
        let password = getPasswordObjectWith(content: "")

        XCTAssertEqual(password.url, PASSWORD_URL)
        XCTAssertEqual(password.namePath, PASSWORD_PATH)
    }

    func testEmptyFile() {
        [
            "",
            "\n",
        ].forEach { fileContent in
            let password = getPasswordObjectWith(content: fileContent)

            XCTAssertEqual(password.password, "")
            XCTAssertEqual(password.plainData, fileContent.data(using: .utf8))
            XCTAssertEqual(password.additionsPlainText, "")
            XCTAssertTrue(password.getFilteredAdditions().isEmpty)
            XCTAssertEqual(password.numberOfUnknowns, 0)

            XCTAssertNil(password.username)
            XCTAssertNil(password.urlString)
            XCTAssertNil(password.login)

            XCTAssertEqual(password.numberOfOtpRelated, 0)
        }
{'fraction_non_alphanumeric': 0.09735234215885948, 'fraction_numerical': 0.010590631364562118, 'mean_word_length': 2.449438202247191, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '352583', 'n_tokens_mistral': 740, 'n_tokens_neox': 694, 'n_words': 129}