Created
July 8, 2020 16:23
-
-
Save atimca/ce8499f5630ec52d40b770a7eba9e405 to your computer and use it in GitHub Desktop.
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
// User wants to open calendar event edit. | |
// User doesn't have permission for editing a calendar. | |
// Request should be sent to the user. | |
// If the user authorized the permission. | |
// Calendar event edit will be opened. | |
// User added new event. -> Calendar State should be saved. And then the scene should be dismissed with Calendar State == nil. | |
// After dismissing dismissedScene should be calendar. | |
func testCalendarUserStoryWithPermission() { | |
// Given | |
let authorizedEvents = [PermissionType.events: PermissionStatus.authorized] | |
let emptyPermissions: [PermissionType: PermissionStatus] = [:] | |
let calendarEvent = CalendarEvent.testEvent | |
// When | |
let result = TestStore( | |
scheduler: scheduler, | |
disposeBag: disposeBag, | |
permissionService: { .just(.authorized) } | |
) | |
.start(with: [.showScene(.calendar(event: calendarEvent)), | |
.userFinishedWithCalendarEditor(with: .saved)]) | |
// Then | |
XCTAssertEqual(result[0].sceneForOpen, nil) | |
XCTAssertEqual(result[0].permissions, emptyPermissions) | |
XCTAssertEqual(result[1].sceneForOpen, .calendar(event: calendarEvent)) | |
XCTAssertEqual(result[1].permissions, emptyPermissions) | |
XCTAssertEqual(result[2].sceneForOpen, .calendar(event: calendarEvent)) | |
XCTAssertEqual(result[2].permissions, authorizedEvents) | |
XCTAssertEqual(result[3].sceneForOpen, nil) | |
XCTAssertEqual(result[3].permissions, authorizedEvents) | |
XCTAssertEqual(result[4].calendarState, .saved) | |
XCTAssertEqual(result[5].calendarState, nil) | |
XCTAssertEqual(result[5].dismissedScene, .calendar(result: .saved)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment