Better search results
This commit is contained in:
parent
0eb4b01fb7
commit
6bf4716366
6 changed files with 160 additions and 136 deletions
55
passKitTests/Models/PasswordTableEntryTest.swift
Normal file
55
passKitTests/Models/PasswordTableEntryTest.swift
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
//
|
||||
// PasswordTableEntryTest.swift
|
||||
// passKitTests
|
||||
//
|
||||
// Created by Yishi Lin on 2020/2/23.
|
||||
// Copyright © 2020 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
@testable import passKit
|
||||
|
||||
class PasswordTableEntryTest: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
let nameWithCategoryList = [
|
||||
"github",
|
||||
"github.com",
|
||||
"www.github.com",
|
||||
"personal/github",
|
||||
"personal/github.com",
|
||||
"personal/www.github.com",
|
||||
"github/personal",
|
||||
"github.com/personal",
|
||||
"www.github.com/personal",
|
||||
"github (personal)",
|
||||
]
|
||||
let searchTextList1 = [
|
||||
"github.com",
|
||||
"www.github.com"
|
||||
]
|
||||
let searchTextList2 = [
|
||||
"xx.com",
|
||||
"www.xx.com"
|
||||
]
|
||||
|
||||
for nameWithCategory in nameWithCategoryList {
|
||||
for searchText in searchTextList1 {
|
||||
XCTAssertTrue(PasswordTableEntry.match(nameWithCategory: nameWithCategory, searchText: searchText))
|
||||
}
|
||||
for searchText in searchTextList2 {
|
||||
XCTAssertFalse(PasswordTableEntry.match(nameWithCategory: nameWithCategory, searchText: searchText))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue