-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5edb2e
commit b6a07a9
Showing
6 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// UserSessionTests.swift | ||
// Rudder | ||
// | ||
// Created by Pallab Maiti on 06/09/23. | ||
// | ||
|
||
import XCTest | ||
@testable import Rudder | ||
|
||
final class UserSessionTests: XCTestCase { | ||
|
||
var userSession: RSUserSession! | ||
|
||
override func setUp() { | ||
super.setUp() | ||
let preferenceManager = RSPreferenceManager.getInstance() | ||
userSession = RSUserSession.initiate(10, with: preferenceManager) | ||
} | ||
|
||
override func tearDown() { | ||
super.tearDown() | ||
} | ||
|
||
func test_startSession() { | ||
userSession.start() | ||
|
||
XCTAssertEqual(userSession.getId(), RSPreferenceManager.getInstance().getSessionId()) | ||
userSession.clear() | ||
} | ||
|
||
func test_startSessionWithId() { | ||
userSession.start(12345678) | ||
|
||
XCTAssertEqual(userSession.getId(), 12345678) | ||
XCTAssertEqual(RSPreferenceManager.getInstance().getSessionId(), 12345678) | ||
userSession.clear() | ||
} | ||
|
||
func test_clearSession() { | ||
userSession.start() | ||
|
||
XCTAssertEqual(userSession.getId(), RSPreferenceManager.getInstance().getSessionId()) | ||
userSession.clear() | ||
|
||
XCTAssertNil(userSession.getId()) | ||
XCTAssertNil(RSPreferenceManager.getInstance().getSessionId()) | ||
} | ||
} |