remove UserDefaults tests
This commit is contained in:
parent
74e8aa959f
commit
69bdcceb4f
|
|
@ -266,9 +266,6 @@
|
|||
671463BE1EB34B1E00EAB194 /* LoadFromNibTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671463B01EB34B1E00EAB194 /* LoadFromNibTests.swift */; };
|
||||
671463BF1EB34B1E00EAB194 /* LoadFromNibTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671463B01EB34B1E00EAB194 /* LoadFromNibTests.swift */; };
|
||||
671463C01EB34B1E00EAB194 /* LoadFromNibTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671463B01EB34B1E00EAB194 /* LoadFromNibTests.swift */; };
|
||||
671463C11EB34B1E00EAB194 /* MappableUserDefaultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671463B11EB34B1E00EAB194 /* MappableUserDefaultsTests.swift */; };
|
||||
671463C21EB34B1E00EAB194 /* MappableUserDefaultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671463B11EB34B1E00EAB194 /* MappableUserDefaultsTests.swift */; };
|
||||
671463C31EB34B1E00EAB194 /* MappableUserDefaultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671463B11EB34B1E00EAB194 /* MappableUserDefaultsTests.swift */; };
|
||||
671463C41EB34B1E00EAB194 /* Post.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671463B31EB34B1E00EAB194 /* Post.swift */; };
|
||||
671463C51EB34B1E00EAB194 /* Post.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671463B31EB34B1E00EAB194 /* Post.swift */; };
|
||||
671463C61EB34B1E00EAB194 /* Post.swift in Sources */ = {isa = PBXBuildFile; fileRef = 671463B31EB34B1E00EAB194 /* Post.swift */; };
|
||||
|
|
@ -485,7 +482,6 @@
|
|||
671463AE1EB34B1E00EAB194 /* StubCursor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubCursor.swift; sourceTree = "<group>"; };
|
||||
671463AF1EB34B1E00EAB194 /* CursorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CursorTests.swift; sourceTree = "<group>"; };
|
||||
671463B01EB34B1E00EAB194 /* LoadFromNibTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadFromNibTests.swift; sourceTree = "<group>"; };
|
||||
671463B11EB34B1E00EAB194 /* MappableUserDefaultsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MappableUserDefaultsTests.swift; sourceTree = "<group>"; };
|
||||
671463B31EB34B1E00EAB194 /* Post.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Post.swift; sourceTree = "<group>"; };
|
||||
671463B41EB34B1E00EAB194 /* PaginationViewModelTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PaginationViewModelTests.swift; sourceTree = "<group>"; };
|
||||
671463B61EB34B1E00EAB194 /* TestView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestView.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -1025,7 +1021,6 @@
|
|||
67186C1A1EB24B7800CFAFFB /* Info-iOS.plist */,
|
||||
6782BBB91EB31DD90086E0B8 /* Info-tvOS.plist */,
|
||||
671463B01EB34B1E00EAB194 /* LoadFromNibTests.swift */,
|
||||
671463B11EB34B1E00EAB194 /* MappableUserDefaultsTests.swift */,
|
||||
671463B41EB34B1E00EAB194 /* PaginationViewModelTests.swift */,
|
||||
);
|
||||
path = Tests;
|
||||
|
|
@ -2042,7 +2037,6 @@
|
|||
A658E5511F8CD9350093527A /* Array+SeparatorRowBoxExtensions.swift in Sources */,
|
||||
671463BB1EB34B1E00EAB194 /* CursorTests.swift in Sources */,
|
||||
A6F32C101F6EBE9600AC08EE /* StringExtensionTests.swift in Sources */,
|
||||
671463C11EB34B1E00EAB194 /* MappableUserDefaultsTests.swift in Sources */,
|
||||
671463BE1EB34B1E00EAB194 /* LoadFromNibTests.swift in Sources */,
|
||||
A6E0DDE31F8A696F002CA74E /* SeparatorCell.swift in Sources */,
|
||||
A6C9A50F1F8BC79D009311CC /* Comparable+Extensions.swift in Sources */,
|
||||
|
|
@ -2213,7 +2207,6 @@
|
|||
671463BA1EB34B1E00EAB194 /* StubCursor.swift in Sources */,
|
||||
671463BD1EB34B1E00EAB194 /* CursorTests.swift in Sources */,
|
||||
A6F32C121F6EBE9800AC08EE /* StringExtensionTests.swift in Sources */,
|
||||
671463C31EB34B1E00EAB194 /* MappableUserDefaultsTests.swift in Sources */,
|
||||
671463C01EB34B1E00EAB194 /* LoadFromNibTests.swift in Sources */,
|
||||
671463C61EB34B1E00EAB194 /* Post.swift in Sources */,
|
||||
);
|
||||
|
|
@ -2311,7 +2304,6 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
671463C21EB34B1E00EAB194 /* MappableUserDefaultsTests.swift in Sources */,
|
||||
A6C9A5111F8BC79D009311CC /* Comparable+Extensions.swift in Sources */,
|
||||
671463BF1EB34B1E00EAB194 /* LoadFromNibTests.swift in Sources */,
|
||||
671463C51EB34B1E00EAB194 /* Post.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -1,103 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import LeadKit
|
||||
import RxSwift
|
||||
|
||||
class MappableUserDefaultsTests: XCTestCase {
|
||||
|
||||
lazy var post: Post = {
|
||||
return Post(userId: 1, postId: 1, title: "First post", body: "")
|
||||
}()
|
||||
|
||||
let posts = Post.generate()
|
||||
|
||||
let userDefaults = UserDefaults.standard
|
||||
|
||||
static let postKey = "post"
|
||||
static let postsKey = "posts"
|
||||
|
||||
let disposeBag = DisposeBag()
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
userDefaults.set(nil, forKey: MappableUserDefaultsTests.postKey)
|
||||
userDefaults.set(nil, forKey: MappableUserDefaultsTests.postsKey)
|
||||
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testPostSave() {
|
||||
userDefaults.set(model: post, forKey: MappableUserDefaultsTests.postKey)
|
||||
|
||||
do {
|
||||
let savedPost: Post = try userDefaults.object(forKey: MappableUserDefaultsTests.postKey)
|
||||
|
||||
XCTAssertTrue(savedPost == post, "Saved post != test post")
|
||||
} catch {
|
||||
XCTFail(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
func testPostsSave() {
|
||||
userDefaults.set(models: posts, forKey: MappableUserDefaultsTests.postsKey)
|
||||
|
||||
do {
|
||||
let savedPosts: [Post] = try userDefaults.objects(forKey: MappableUserDefaultsTests.postsKey)
|
||||
|
||||
XCTAssertTrue(savedPosts == posts, "Saved posts != test posts")
|
||||
} catch {
|
||||
XCTFail(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
func testRxPostSave() {
|
||||
userDefaults.rx.set(model: post, forKey: MappableUserDefaultsTests.postKey)
|
||||
.flatMap {
|
||||
self.userDefaults.rx.object(forKey: MappableUserDefaultsTests.postKey) as Observable<Post>
|
||||
}
|
||||
.subscribe(onNext: { savedPost in
|
||||
XCTAssertTrue(savedPost == self.post, "Saved post != test post")
|
||||
}, onError: { error in
|
||||
XCTFail(error.localizedDescription)
|
||||
})
|
||||
.disposed(by: disposeBag)
|
||||
}
|
||||
|
||||
func testRxPostsSave() {
|
||||
userDefaults.rx.set(models: posts, forKey: MappableUserDefaultsTests.postsKey)
|
||||
.flatMap {
|
||||
self.userDefaults.rx.object(forKey: MappableUserDefaultsTests.postsKey) as Observable<[Post]>
|
||||
}
|
||||
.subscribe(onNext: { savedPosts in
|
||||
XCTAssertTrue(savedPosts == self.posts, "Saved posts != test posts")
|
||||
}, onError: { error in
|
||||
XCTFail(error.localizedDescription)
|
||||
})
|
||||
.disposed(by: disposeBag)
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue