Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
DataSource test coverage update (#87), close #81
Browse files Browse the repository at this point in the history
  • Loading branch information
Panagiotis Sartzetakis authored and jessesquires committed Dec 23, 2016
1 parent 447379f commit e3e0174
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Tests/DataSourceTests.swift
Expand Up @@ -241,6 +241,19 @@ final class DataSourceTests: XCTestCase {
XCTAssertEqual(dataSource[ip], item)
}

func test_thatDataSource_returnsNil_whenDataFromInvalidSection_areRequested() {
// GIVEN: a data source
let sectionA = Section(items: FakeViewModel(), FakeViewModel(), headerTitle: "Header")
let sectionB = Section(items: FakeViewModel(), FakeViewModel(), footerTitle: "Footer")
let dataSource = DataSource(sections: sectionA, sectionB)

// WHEN: we request an item from an invalid section
let requestedItem = dataSource.item(atRow: 0, inSection: 2)

// THEN: the returned item should be nil
XCTAssertNil(requestedItem, "The requested section shouldn't exist")
}

func test_thatDataSource_insertsExpectedData_atIndexPath() {
// GIVEN: a data source
let sectionA = Section(items: FakeViewModel(), FakeViewModel(), headerTitle: "Header")
Expand Down

0 comments on commit e3e0174

Please sign in to comment.