ios_catalogue1-10 Exercise 2: Run the Tests ============================================ Add a unit-test target in Xcode if the project has none (File > New > Target > Unit Testing Bundle), put the test file in it, and run with Cmd-U. Your results depend on your project; how to read them: testBlankTitleIsInvalid, testYearRules Pure Swift. A failure means ItemDraft differs from Chapter 6 (for example the year range). Fix the code if the rule is wrong, or the test if you deliberately changed the rule. testTagsAreCaseInsensitiveAndShared Exercises the find-before-insert design from Chapters 2-3. A failure with two tags means tag(named:) is not searching by the folded key, or the unique-key behaviour is not what was assumed: this is the unverified point. testRoundTripAndMerge Failure on the second import (added 1 instead of 0) means the signature does not match: check that createdAt survives the millisecond round trip (it is rounded, so a Date with sub-millisecond parts must still compare equal after export). testUnknownTypeChangesNothing Failure with items present means something was inserted before the type check; validation must complete before any insert. Compile errors in the test target are likely: the module name after @testable import, initialiser labels, and a missing @MainActor. Report each as found. Your own test (ListViewModel): func testTypeAndTagFilter() throws { let context = try makeContext() let repo = CatalogueRepository(context: context) let types = try repo.itemTypes() let a = Item(title: "A", creator: "", type: types[0]); try repo.save(a, tagNames: ["x"]) let b = Item(title: "B", creator: "", type: types[1]); try repo.save(b, tagNames: []) let model = ListViewModel() model.selectedTypeName = types[0].name XCTAssertEqual(model.filtered([a, b]).map(\.title), ["A"]) model.selectedTypeName = nil; model.selectedTagKey = Tag.key(for: "x") XCTAssertEqual(model.filtered([a, b]).map(\.title), ["A"]) } Never weaken an assertion to make a failing test pass without understanding why it failed.