Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace NullStore with InMemoryFeedStore #80

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions EssentialApp/EssentialApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
0835BF6D24850F9800A793D2 /* CombineHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0835BF6C24850F9800A793D2 /* CombineHelpers.swift */; };
08367CD82486FB51009CD536 /* UIView+TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08367CD72486FB51009CD536 /* UIView+TestHelpers.swift */; };
0851CDAC239AB13100C19B1D /* HTTPClientStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0851CDAB239AB13100C19B1D /* HTTPClientStub.swift */; };
0851CDAE239AB19000C19B1D /* InMemoryFeedStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0851CDAD239AB19000C19B1D /* InMemoryFeedStore.swift */; };
088B441925309AA300D75AAD /* CommentsUIIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 088B441825309AA300D75AAD /* CommentsUIIntegrationTests.swift */; };
088B441C25309B6E00D75AAD /* CommentsUIComposer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 088B441B25309B6E00D75AAD /* CommentsUIComposer.swift */; };
0895DA87234B3B950031BB2D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0895DA86234B3B950031BB2D /* AppDelegate.swift */; };
Expand All @@ -38,7 +37,6 @@
0895DAAC234B3F7E0031BB2D /* EssentialFeed.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0895DAA9234B3F7E0031BB2D /* EssentialFeed.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0895DAAD234B3F7E0031BB2D /* EssentialFeediOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0895DAAA234B3F7E0031BB2D /* EssentialFeediOS.framework */; };
0895DAAE234B3F7E0031BB2D /* EssentialFeediOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0895DAAA234B3F7E0031BB2D /* EssentialFeediOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
08CF92F62555A15B006B7E7D /* NullStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08CF92F52555A15B006B7E7D /* NullStore.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -87,7 +85,6 @@
0835BF6C24850F9800A793D2 /* CombineHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CombineHelpers.swift; sourceTree = "<group>"; };
08367CD72486FB51009CD536 /* UIView+TestHelpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+TestHelpers.swift"; sourceTree = "<group>"; };
0851CDAB239AB13100C19B1D /* HTTPClientStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPClientStub.swift; sourceTree = "<group>"; };
0851CDAD239AB19000C19B1D /* InMemoryFeedStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InMemoryFeedStore.swift; sourceTree = "<group>"; };
088B441825309AA300D75AAD /* CommentsUIIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentsUIIntegrationTests.swift; sourceTree = "<group>"; };
088B441B25309B6E00D75AAD /* CommentsUIComposer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentsUIComposer.swift; sourceTree = "<group>"; };
0895DA83234B3B950031BB2D /* EssentialApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EssentialApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -103,7 +100,6 @@
08B5033725346BAC003FF218 /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
08B5033925346BE1003FF218 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
08B5033B25346BFE003FF218 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
08CF92F52555A15B006B7E7D /* NullStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NullStore.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -141,7 +137,6 @@
082C00032359E46C008927D3 /* XCTestCase+MemoryLeakTracking.swift */,
082C00052359E4C6008927D3 /* SharedTestHelpers.swift */,
0851CDAB239AB13100C19B1D /* HTTPClientStub.swift */,
0851CDAD239AB19000C19B1D /* InMemoryFeedStore.swift */,
);
path = Helpers;
sourceTree = "<group>";
Expand Down Expand Up @@ -171,7 +166,6 @@
children = (
0895DA86234B3B950031BB2D /* AppDelegate.swift */,
0895DA88234B3B950031BB2D /* SceneDelegate.swift */,
08CF92F52555A15B006B7E7D /* NullStore.swift */,
0835BF6C24850F9800A793D2 /* CombineHelpers.swift */,
08073B42238D2DF900A75DC6 /* FeedUIComposer.swift */,
088B441B25309B6E00D75AAD /* CommentsUIComposer.swift */,
Expand Down Expand Up @@ -315,7 +309,6 @@
08073B44238D2DFA00A75DC6 /* FeedUIComposer.swift in Sources */,
0895DA87234B3B950031BB2D /* AppDelegate.swift in Sources */,
08073B45238D2DFA00A75DC6 /* LoadResourcePresentationAdapter.swift in Sources */,
08CF92F62555A15B006B7E7D /* NullStore.swift in Sources */,
08073B48238D2DFA00A75DC6 /* WeakRefVirtualProxy.swift in Sources */,
0895DA89234B3B950031BB2D /* SceneDelegate.swift in Sources */,
08073B49238D2DFA00A75DC6 /* FeedViewAdapter.swift in Sources */,
Expand All @@ -336,7 +329,6 @@
0832C9D0238D2811002314C9 /* SceneDelegateTests.swift in Sources */,
08073B5B238D2E1000A75DC6 /* ListViewController+TestHelpers.swift in Sources */,
08073B53238D2E1000A75DC6 /* UIButton+TestHelpers.swift in Sources */,
0851CDAE239AB19000C19B1D /* InMemoryFeedStore.swift in Sources */,
08073B59238D2E1000A75DC6 /* UIImage+TestHelpers.swift in Sources */,
0851CDAC239AB13100C19B1D /* HTTPClientStub.swift in Sources */,
08073B5A238D2E1000A75DC6 /* UIRefreshControl+TestHelpers.swift in Sources */,
Expand Down
22 changes: 0 additions & 22 deletions EssentialApp/EssentialApp/NullStore.swift

This file was deleted.

5 changes: 2 additions & 3 deletions EssentialApp/EssentialApp/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

return DispatchQueue(
label: "com.essentialdeveloper.infra.queue",
qos: .userInitiated,
attributes: .concurrent
qos: .userInitiated
).eraseToAnyScheduler()
}()

Expand All @@ -38,7 +37,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
} catch {
assertionFailure("Failed to instantiate CoreData store with error: \(error.localizedDescription)")
logger.fault("Failed to instantiate CoreData store with error: \(error.localizedDescription)")
return NullStore()
return InMemoryFeedStore()
}
}()

Expand Down
53 changes: 0 additions & 53 deletions EssentialApp/EssentialAppTests/Helpers/InMemoryFeedStore.swift

This file was deleted.

38 changes: 37 additions & 1 deletion EssentialFeed/EssentialFeed.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
087546942272387900542C32 /* XCTestCase+FailableDeleteFeedStoreSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 087546932272387900542C32 /* XCTestCase+FailableDeleteFeedStoreSpecs.swift */; };
08805A19233A9F8600509F19 /* URLProtocolStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08805A18233A9F8600509F19 /* URLProtocolStub.swift */; };
0886893A221DAA34007BC3E7 /* LocalFeedImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08868939221DAA34007BC3E7 /* LocalFeedImage.swift */; };
088887B12BB3229900E3723E /* InMemoryFeedStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 088887B02BB3229900E3723E /* InMemoryFeedStore.swift */; };
088887B32BB322F600E3723E /* InMemoryFeedStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 088887B22BB322F600E3723E /* InMemoryFeedStoreTests.swift */; };
088887B62BB40BA100E3723E /* FeedImageDataStoreSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 088887B52BB40BA100E3723E /* FeedImageDataStoreSpecs.swift */; };
088887B82BB40C2700E3723E /* XCTestCase+FeedImageDataStoreSpecs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 088887B72BB40C2700E3723E /* XCTestCase+FeedImageDataStoreSpecs.swift */; };
08897BE623390F4E0029F5E4 /* FeedImageDataLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FC5AA922D5F47900148E12 /* FeedImageDataLoader.swift */; };
08897BE8233910040029F5E4 /* FeedImageDataMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08897BE7233910040029F5E4 /* FeedImageDataMapperTests.swift */; };
08897BEF233A1C8E0029F5E4 /* HTTPURLResponse+StatusCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08897BEE233A1C8E0029F5E4 /* HTTPURLResponse+StatusCode.swift */; };
Expand Down Expand Up @@ -117,6 +121,7 @@
08DB54FC254465BA00B98C3A /* FEED_WITH_LOAD_MORE_ERROR_extraExtraExtraLarge.png in Resources */ = {isa = PBXBuildFile; fileRef = 08DB54F9254465BA00B98C3A /* FEED_WITH_LOAD_MORE_ERROR_extraExtraExtraLarge.png */; };
08DB5510254467FC00B98C3A /* Paginated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08DB550F254467FC00B98C3A /* Paginated.swift */; };
08DDC13A21BEA99E00F490ED /* FeedItemsMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08DDC13921BEA99E00F490ED /* FeedItemsMapperTests.swift */; };
08E53C692BB41454002F3D93 /* InMemoryFeedImageDataStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E53C682BB41454002F3D93 /* InMemoryFeedImageDataStoreTests.swift */; };
08E546CC24F9631300C64FAE /* FeedImageDataMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E546CB24F9631300C64FAE /* FeedImageDataMapper.swift */; };
08E5941522523FCC00E2D213 /* FeedCachePolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E5941422523FCC00E2D213 /* FeedCachePolicy.swift */; };
08EF9D17250BB0E4004539C2 /* LoadResourcePresenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08EF9D16250BB0E4004539C2 /* LoadResourcePresenterTests.swift */; };
Expand Down Expand Up @@ -247,6 +252,10 @@
087546932272387900542C32 /* XCTestCase+FailableDeleteFeedStoreSpecs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCTestCase+FailableDeleteFeedStoreSpecs.swift"; sourceTree = "<group>"; };
08805A18233A9F8600509F19 /* URLProtocolStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLProtocolStub.swift; sourceTree = "<group>"; };
08868939221DAA34007BC3E7 /* LocalFeedImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalFeedImage.swift; sourceTree = "<group>"; };
088887B02BB3229900E3723E /* InMemoryFeedStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InMemoryFeedStore.swift; sourceTree = "<group>"; };
088887B22BB322F600E3723E /* InMemoryFeedStoreTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InMemoryFeedStoreTests.swift; sourceTree = "<group>"; };
088887B52BB40BA100E3723E /* FeedImageDataStoreSpecs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedImageDataStoreSpecs.swift; sourceTree = "<group>"; };
088887B72BB40C2700E3723E /* XCTestCase+FeedImageDataStoreSpecs.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTestCase+FeedImageDataStoreSpecs.swift"; sourceTree = "<group>"; };
08897BE7233910040029F5E4 /* FeedImageDataMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedImageDataMapperTests.swift; sourceTree = "<group>"; };
08897BEE233A1C8E0029F5E4 /* HTTPURLResponse+StatusCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HTTPURLResponse+StatusCode.swift"; sourceTree = "<group>"; };
0889B0F92530B0AA00FEAB5A /* ImageCommentsEndpoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCommentsEndpoint.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -280,6 +289,7 @@
08DB54F9254465BA00B98C3A /* FEED_WITH_LOAD_MORE_ERROR_extraExtraExtraLarge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = FEED_WITH_LOAD_MORE_ERROR_extraExtraExtraLarge.png; sourceTree = "<group>"; };
08DB550F254467FC00B98C3A /* Paginated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Paginated.swift; sourceTree = "<group>"; };
08DDC13921BEA99E00F490ED /* FeedItemsMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedItemsMapperTests.swift; sourceTree = "<group>"; };
08E53C682BB41454002F3D93 /* InMemoryFeedImageDataStoreTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InMemoryFeedImageDataStoreTests.swift; sourceTree = "<group>"; };
08E546CB24F9631300C64FAE /* FeedImageDataMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedImageDataMapper.swift; sourceTree = "<group>"; };
08E5941422523FCC00E2D213 /* FeedCachePolicy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedCachePolicy.swift; sourceTree = "<group>"; };
08EF9D16250BB0E4004539C2 /* LoadResourcePresenterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadResourcePresenterTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -533,6 +543,7 @@
08285AF7228C16D7000A8987 /* Infrastructure */ = {
isa = PBXGroup;
children = (
08E53C6A2BB4165A002F3D93 /* InMemory */,
08285AF8228C16E5000A8987 /* CoreData */,
);
path = Infrastructure;
Expand Down Expand Up @@ -702,6 +713,15 @@
path = FeedStoreSpecs;
sourceTree = "<group>";
};
088887B42BB40B8800E3723E /* FeedImageDataStoreSpecs */ = {
isa = PBXGroup;
children = (
088887B52BB40BA100E3723E /* FeedImageDataStoreSpecs.swift */,
088887B72BB40C2700E3723E /* XCTestCase+FeedImageDataStoreSpecs.swift */,
);
path = FeedImageDataStoreSpecs;
sourceTree = "<group>";
};
08897BE9233939AA0029F5E4 /* Helpers */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -732,13 +752,16 @@
children = (
086BE48222327254004CDC26 /* Helpers */,
08754695227238B100542C32 /* FeedStoreSpecs */,
088887B42BB40B8800E3723E /* FeedImageDataStoreSpecs */,
089C40D32216C37400DE552E /* CacheFeedUseCaseTests.swift */,
086BE480223270A3004CDC26 /* LoadFeedFromCacheUseCaseTests.swift */,
081C0DAE22491A2400AC754E /* ValidateFeedCacheUseCaseTests.swift */,
08285AEE228BF7E3000A8987 /* CoreDataFeedStoreTests.swift */,
08C4E983233E037200D939F8 /* LoadFeedImageDataFromCacheUseCaseTests.swift */,
086044FD233E1A90005ECD22 /* CacheFeedImageDataUseCaseTests.swift */,
08285AEE228BF7E3000A8987 /* CoreDataFeedStoreTests.swift */,
086044FF233E2294005ECD22 /* CoreDataFeedImageDataStoreTests.swift */,
088887B22BB322F600E3723E /* InMemoryFeedStoreTests.swift */,
08E53C682BB41454002F3D93 /* InMemoryFeedImageDataStoreTests.swift */,
);
path = "Feed Cache";
sourceTree = "<group>";
Expand Down Expand Up @@ -817,6 +840,14 @@
path = EssentialFeediOSTests;
sourceTree = "<group>";
};
08E53C6A2BB4165A002F3D93 /* InMemory */ = {
isa = PBXGroup;
children = (
088887B02BB3229900E3723E /* InMemoryFeedStore.swift */,
);
path = InMemory;
sourceTree = "<group>";
};
08EF9D15250BB0C2004539C2 /* Shared Presentation */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1172,6 +1203,7 @@
080F9A372531DDC600EAD475 /* FeedEndpoint.swift in Sources */,
080EDF0C21B6DAE800813479 /* FeedImage.swift in Sources */,
0889B0FA2530B0AA00FEAB5A /* ImageCommentsEndpoint.swift in Sources */,
088887B12BB3229900E3723E /* InMemoryFeedStore.swift in Sources */,
0804862E236345A40087ED48 /* FeedImageDataCache.swift in Sources */,
08C4E988233E13CC00D939F8 /* FeedImageDataStore.swift in Sources */,
087148B6232BEAAF00D6BE1A /* FeedPresenter.swift in Sources */,
Expand Down Expand Up @@ -1199,6 +1231,7 @@
080F9A2F2531DD6200EAD475 /* ImageCommentsEndpointTests.swift in Sources */,
08805A19233A9F8600509F19 /* URLProtocolStub.swift in Sources */,
081C0DAF22491A2400AC754E /* ValidateFeedCacheUseCaseTests.swift in Sources */,
08E53C692BB41454002F3D93 /* InMemoryFeedImageDataStoreTests.swift in Sources */,
087148AC232BDF6900D6BE1A /* FeedPresenterTests.swift in Sources */,
08897BE8233910040029F5E4 /* FeedImageDataMapperTests.swift in Sources */,
08DDC13A21BEA99E00F490ED /* FeedItemsMapperTests.swift in Sources */,
Expand All @@ -1209,19 +1242,22 @@
087148BE232BEDFD00D6BE1A /* FeedLocalizationTests.swift in Sources */,
082DB86421F763F900A71F69 /* URLSessionHTTPClientTests.swift in Sources */,
08C4E984233E037200D939F8 /* LoadFeedImageDataFromCacheUseCaseTests.swift in Sources */,
088887B62BB40BA100E3723E /* FeedImageDataStoreSpecs.swift in Sources */,
08346CEB24F93B0A00A9F17C /* ImageCommentsMapperTests.swift in Sources */,
086BE4842232725E004CDC26 /* FeedStoreSpy.swift in Sources */,
081C0DB322491EEF00AC754E /* SharedTestHelpers.swift in Sources */,
089C40D42216C37400DE552E /* CacheFeedUseCaseTests.swift in Sources */,
08EF9D1E250BB77A004539C2 /* SharedLocalizationTests.swift in Sources */,
086044FC233E1A3B005ECD22 /* FeedImageDataStoreSpy.swift in Sources */,
088887B32BB322F600E3723E /* InMemoryFeedStoreTests.swift in Sources */,
08EF9D33250BCA28004539C2 /* ImageCommentsLocalizationTests.swift in Sources */,
08604500233E2294005ECD22 /* CoreDataFeedImageDataStoreTests.swift in Sources */,
087546942272387900542C32 /* XCTestCase+FailableDeleteFeedStoreSpecs.swift in Sources */,
08754690227237C900542C32 /* XCTestCase+FailableRetrieveFeedStoreSpecs.swift in Sources */,
086BE481223270A3004CDC26 /* LoadFeedFromCacheUseCaseTests.swift in Sources */,
080F9A3F2531DDFB00EAD475 /* FeedEndpointTests.swift in Sources */,
0875468C2272340500542C32 /* FeedStoreSpecs.swift in Sources */,
088887B82BB40C2700E3723E /* XCTestCase+FeedImageDataStoreSpecs.swift in Sources */,
08EF9D17250BB0E4004539C2 /* LoadResourcePresenterTests.swift in Sources */,
0844768F21FCB24E00439BE9 /* XCTestCase+MemoryLeakTracking.swift in Sources */,
08285AEF228BF7E3000A8987 /* CoreDataFeedStoreTests.swift in Sources */,
Expand Down
Loading