@@ -2,9 +2,66 @@ import ComposableArchitecture
22import XCTest
33
44@testable import FeaturePokit
5+ @testable import Domain
56
67final class FeaturePokitTests : XCTestCase {
7- func test( ) {
8+ /// ex) 1.3.5버전일 때
9+ /// 1: Major
10+ /// 3: Minor
11+ /// 5: Patch
812
13+ func test_patch_버전이_앱스토어가_더_커도_업데이트가_필요하지_않다( ) {
14+ let current_V = Version ( " 1.0.8 " , trackId: 0 )
15+ let appStore_V = Version ( " 1.0.9 " , trackId: 0 )
16+
17+ let result = updateNeeded ( currentVersion: current_V, appStoreVersion: appStore_V)
18+ /// expect: False
19+ XCTAssertFalse ( result)
20+ }
21+
22+ func test_minor_버전이_앱스토어가_더_클때_업데이트가_필요하다( ) {
23+ let current_V = Version ( " 1.0.8 " , trackId: 0 )
24+ let appStore_V = Version ( " 1.1.8 " , trackId: 0 )
25+
26+ let result = updateNeeded ( currentVersion: current_V, appStoreVersion: appStore_V)
27+ /// expect: True
28+ XCTAssertTrue ( result)
29+ }
30+
31+ func test_major_버전이_앱스토어가_더_클때_업데이트가_필요하다( ) {
32+ let current_V = Version ( " 1.0.8 " , trackId: 0 )
33+ let appStore_V = Version ( " 2.0.8 " , trackId: 0 )
34+
35+ let result = updateNeeded ( currentVersion: current_V, appStoreVersion: appStore_V)
36+ /// expect: True
37+ XCTAssertTrue ( result)
38+ }
39+
40+ func test_major는_앱스토어가_더_높고_minor는_현재_버전이_더_클때_업데이트가_필요하다( ) {
41+ let current_V = Version ( " 1.6.4 " , trackId: 0 )
42+ let appStore_V = Version ( " 2.1.4 " , trackId: 0 )
43+
44+ let result = updateNeeded ( currentVersion: current_V, appStoreVersion: appStore_V)
45+ /// expect: True
46+ XCTAssertTrue ( result)
47+ }
48+
49+ func test_버전이_같다면_업데이트가_필요하지_않다( ) {
50+ let current_V = Version ( " 1.0.8 " , trackId: 0 )
51+ let appStore_V = Version ( " 1.0.8 " , trackId: 0 )
52+
53+ let result = updateNeeded ( currentVersion: current_V, appStoreVersion: appStore_V)
54+ /// expect: False
55+ XCTAssertFalse ( result)
56+ }
57+
58+ }
59+
60+ extension FeaturePokitTests {
61+ func updateNeeded(
62+ currentVersion: Version ,
63+ appStoreVersion: Version
64+ ) -> Bool {
65+ return currentVersion < appStoreVersion
966 }
1067}
0 commit comments