@@ -167,6 +167,42 @@ final class TableViewDiffableDataSourceTests: XCTestCase {
167167 cell
168168 )
169169 }
170+
171+ func testCanEditRowAt( ) {
172+ let tableView = MockTableView ( )
173+ let cell = UITableViewCell ( )
174+ let dataSource = TableViewDiffableDataSource < Int , Int > ( tableView: tableView) { _, _, _ in
175+ cell
176+ }
177+
178+ var snapshot = DiffableDataSourceSnapshot < Int , Int > ( )
179+ snapshot. appendSections ( [ 0 , 1 , 2 ] )
180+ snapshot. appendItems ( [ 0 , 1 , 2 ] , toSection: 0 )
181+ dataSource. apply ( snapshot)
182+
183+ XCTAssertEqual (
184+ dataSource. tableView ( tableView, canEditRowAt: IndexPath ( item: 1 , section: 0 ) ) ,
185+ false
186+ )
187+ }
188+
189+ func testCanMoveRowAt( ) {
190+ let tableView = MockTableView ( )
191+ let cell = UITableViewCell ( )
192+ let dataSource = TableViewDiffableDataSource < Int , Int > ( tableView: tableView) { _, _, _ in
193+ cell
194+ }
195+
196+ var snapshot = DiffableDataSourceSnapshot < Int , Int > ( )
197+ snapshot. appendSections ( [ 0 , 1 , 2 ] )
198+ snapshot. appendItems ( [ 0 , 1 , 2 ] , toSection: 0 )
199+ dataSource. apply ( snapshot)
200+
201+ XCTAssertEqual (
202+ dataSource. tableView ( tableView, canMoveRowAt: IndexPath ( item: 1 , section: 0 ) ) ,
203+ false
204+ )
205+ }
170206}
171207
172208final class MockTableView : UITableView {
0 commit comments