Implemented the "none" and "sample" constants for the Array+ReviewDTOs extension in the Feed framework.

This commit is contained in:
Javier Cicchelli 2024-03-22 13:42:45 +01:00
parent 6c3c66f3ab
commit 4ea48bd671
4 changed files with 88 additions and 83 deletions

View File

@ -0,0 +1,65 @@
//
// Array+ReviewDTOs.swift
// ReviewsFeed
//
// Created by Javier Cicchelli on 22/03/2024.
// Copyright © 2024 Röck+Cöde. All rights reserved.
//
import Foundation
import ReviewsFeedKit
extension Array where Element == ReviewsFeedKit.Review {
// MARK: Constants
static let none: [ReviewsFeedKit.Review] = []
static let sample: [ReviewsFeedKit.Review] = [
.init(
id: 1,
author: "Some author name #1 here",
title: "Some review title #1 goes here...",
content: "Some long, long, explanatory review comment #1 goes here...",
rating: 3,
version: "v1.0.0",
updated: .init()
),
.init(
id: 2,
author: "Some author name #2 here",
title: "Some review title #2 goes here...",
content: "Some long, long, explanatory review comment #2 goes here...",
rating: 5,
version: "v1.0.0",
updated: .init()
),
.init(
id: 3,
author: "Some author name #3 here",
title: "Some review title #3 goes here...",
content: "Some long, long, explanatory review comment #3 goes here...",
rating: 1,
version: "v1.0.0",
updated: .init()
),
.init(
id: 4,
author: "Some author name #4 here",
title: "Some review title #4 goes here...",
content: "Some long, long, explanatory review comment #4 goes here...",
rating: 4,
version: "v1.0.0",
updated: .init()
),
.init(
id: 5,
author: "Some author name #5 here",
title: "Some review title #5 goes here...",
content: "Some long, long, explanatory review comment #5 goes here...",
rating: 2,
version: "v1.0.0",
updated: .init()
),
]
}

View File

@ -455,53 +455,7 @@ import ReviewsiTunesKit
#Preview("Feed List with few reviews") {
MockURLProtocol.response = .init(
statusCode: 200,
object: Feed(entries: [
.init(
id: 1,
author: "Some author name #1 here",
title: "Some review title #1 goes here...",
content: "Some long, explanatory review comment #1 goes here...",
rating: 3,
version: "v1.0.0",
updated: .init()
),
.init(
id: 2,
author: "Some author name #2 here",
title: "Some review title #2 goes here...",
content: "Some long, explanatory review comment #2 goes here...",
rating: 5,
version: "v1.0.0",
updated: .init()
),
.init(
id: 3,
author: "Some author name #3 here",
title: "Some review title #3 goes here...",
content: "Some long, explanatory review comment #3 goes here...",
rating: 1,
version: "v1.0.0",
updated: .init()
),
.init(
id: 4,
author: "Some author name #4 here",
title: "Some review title #4 goes here...",
content: "Some long, explanatory review comment #4 goes here...",
rating: 4,
version: "v1.0.0",
updated: .init()
),
.init(
id: 5,
author: "Some author name #5 here",
title: "Some review title #5 goes here...",
content: "Some long, explanatory review comment #5 goes here...",
rating: 2,
version: "v1.0.0",
updated: .init()
),
])
object: Feed(entries: .sample)
)
return UINavigationController(rootViewController: FeedListViewController(.init(

View File

@ -1,36 +0,0 @@
//
// ReviewsFeedTests.swift
// ReviewsFeedTests
//
// Created by Javier Cicchelli on 22/03/2024.
// Copyright © 2024 Röck+Cöde. All rights reserved.
//
import XCTest
final class ReviewsFeedTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
// Any test you write for XCTest can be annotated as throws and async.
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
measure {
// Put the code you want to measure the time of here.
}
}
}

View File

@ -20,6 +20,7 @@
02909E7D2BAB7FFE00710E14 /* Review+DTOs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02909E7C2BAB7FFE00710E14 /* Review+DTOs.swift */; };
02B36F7C2BAD9D1A00F1A89D /* ReviewsFeedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02B36F7B2BAD9D1A00F1A89D /* ReviewsFeedTests.swift */; };
02B36F7D2BAD9D1A00F1A89D /* ReviewsFeed.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02DC7F8F2BA51793000EEEBE /* ReviewsFeed.framework */; platformFilter = ios; };
02B36F892BADB26C00F1A89D /* Array+ReviewDTOs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02B36F882BADB26C00F1A89D /* Array+ReviewDTOs.swift */; };
02C1B1972BAC9BFE001781DE /* FeedListCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02C1B1962BAC9BFE001781DE /* FeedListCoordinator.swift */; };
02C1B1A92BACA722001781DE /* AppCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02C1B1A82BACA722001781DE /* AppCoordinator.swift */; };
02DA924E2BAAE3FD00C47985 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 02DA924D2BAAE3FD00C47985 /* Localizable.xcstrings */; };
@ -86,6 +87,7 @@
02909E7C2BAB7FFE00710E14 /* Review+DTOs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Review+DTOs.swift"; sourceTree = "<group>"; };
02B36F792BAD9D1A00F1A89D /* FeedTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FeedTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
02B36F7B2BAD9D1A00F1A89D /* ReviewsFeedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewsFeedTests.swift; sourceTree = "<group>"; };
02B36F882BADB26C00F1A89D /* Array+ReviewDTOs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+ReviewDTOs.swift"; sourceTree = "<group>"; };
02C1B1962BAC9BFE001781DE /* FeedListCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListCoordinator.swift; sourceTree = "<group>"; };
02C1B1A82BACA722001781DE /* AppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppCoordinator.swift; sourceTree = "<group>"; };
02DA924D2BAAE3FD00C47985 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
@ -236,6 +238,7 @@
02DC7F912BA51793000EEEBE /* ReviewsFeed.h */,
02DA924B2BAAE3E500C47985 /* Resources */,
02DC7FB02BA51B4F000EEEBE /* Sources */,
02B36F862BADB1FD00F1A89D /* Previews */,
);
path = Bundle;
sourceTree = "<group>";
@ -256,6 +259,22 @@
path = Tests;
sourceTree = "<group>";
};
02B36F862BADB1FD00F1A89D /* Previews */ = {
isa = PBXGroup;
children = (
02B36F872BADB23200F1A89D /* Extensions */,
);
path = Previews;
sourceTree = "<group>";
};
02B36F872BADB23200F1A89D /* Extensions */ = {
isa = PBXGroup;
children = (
02B36F882BADB26C00F1A89D /* Array+ReviewDTOs.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
02C1B1952BAC9BE7001781DE /* Coordinators */ = {
isa = PBXGroup;
children = (
@ -564,6 +583,7 @@
buildActionMask = 2147483647;
files = (
02EACF302BABA50D00FF8ECD /* TopWordsCell.swift in Sources */,
02B36F892BADB26C00F1A89D /* Array+ReviewDTOs.swift in Sources */,
02620B8C2BA89C9A00DE7137 /* FeedListViewModel.swift in Sources */,
02EACF342BABB28900FF8ECD /* TopWord.swift in Sources */,
023AC7FC2BAA3EC10027D064 /* Int+Constants.swift in Sources */,
@ -687,6 +707,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = Frameworks/Feed/Bundle/Previews;
DEVELOPMENT_TEAM = 7FMNM89WKG;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -736,6 +757,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = Frameworks/Feed/Bundle/Previews;
DEVELOPMENT_TEAM = 7FMNM89WKG;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;