Last active
October 18, 2020 02:44
-
-
Save agiletalk/b456fd9a91fbf5a5789466cf02c5c1a0 to your computer and use it in GitHub Desktop.
Interactor Tests
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
describe("뷰가 로드되었을 때") { | |
var interactor: EventKeywordNoticeInteractor! | |
var presenter: EventKeywordNoticePresenterMock! | |
let worker = EventKeywordNoticeWorkerMock() | |
beforeEach { | |
interactor = EventKeywordNoticeInteractor(worker: worker) | |
presenter = EventKeywordNoticePresenterMock() | |
interactor.presenter = presenter | |
} | |
context("선택한 관심 키워드를 가져오는데 성공하면") { | |
beforeEach { | |
let request = EventKeywordNotice.Request.OnLoad() | |
interactor.process(request) | |
} | |
it("선택한 관심 키워드를 전달한다") { | |
expect(presenter.displayInterestKeywordsCalled).to(beTrue()) | |
} | |
} | |
} | |
describe("키워드를 선택했을 때") { | |
var interactor: EventKeywordNoticeInteractor! | |
var presenter: EventKeywordNoticePresenterMock! | |
let worker = EventKeywordNoticeWorkerMock() | |
let selectedKeywords = [ | |
EventKeyword.Keyword(id: 1, kind: "EVENT", keyword: "a.b.c", title: "키워드1"), | |
EventKeyword.Keyword(id: 2, kind: "EVENT", keyword: "d.e.f", title: "키워드2") | |
] | |
beforeEach { | |
interactor = EventKeywordNoticeInteractor(keywords: selectedKeywords, worker: worker) | |
presenter = EventKeywordNoticePresenterMock() | |
interactor.presenter = presenter | |
} | |
context("키워드 선택이 완료되면") { | |
it("선택한 키워드를 전달한다") { | |
let request = EventKeywordNotice.Request.SelectKeywords( | |
indexPaths: [IndexPath(row: 0, section: 0), IndexPath(row: 1, section: 0)] | |
) | |
interactor.process(request) | |
expect(presenter.displayInterestKeywordsCalled).to(beTrue()) | |
expect(presenter.displayInterestKeywords.count).to(equal(selectedKeywords.count)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment