Skip to content

Commit

Permalink
🔧 경로 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
chopmozzi committed Dec 13, 2023
1 parent 523d719 commit ed21d32
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
10 changes: 3 additions & 7 deletions iOS/Layover/LayoverTests/Mocks/Workers/MockPlaybackWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ final class MockPlaybackWorker: PlaybackWorkerProtocol {
}

func fetchHomePosts() async -> [Post]? {
guard let fileLocation = Bundle.main.url(forResource: "PostList",
withExtension: "json") else { return nil }

guard let fileLocation = Bundle(for: type(of: self)).url(forResource: "PostList", withExtension: "json") else { return nil }
do {
let mockData = try Data(contentsOf: fileLocation)
MockURLProtocol.requestHandler = { request in
Expand All @@ -125,7 +123,7 @@ final class MockPlaybackWorker: PlaybackWorkerProtocol {

func fetchProfilePosts(profileID: Int?, page: Int) async -> [Post]? {
let resourceFileName = switch page { case 1: "PostList" case 2: "PostListMore" default: "PostListEnd" }
guard let fileLocation = Bundle.main.url(forResource: resourceFileName, withExtension: "json") else { return nil }
guard let fileLocation = Bundle(for: type(of: self)).url(forResource: resourceFileName, withExtension: "json") else { return nil }
do {
let mockData = try Data(contentsOf: fileLocation)
MockURLProtocol.requestHandler = { request in
Expand All @@ -148,9 +146,7 @@ final class MockPlaybackWorker: PlaybackWorkerProtocol {

func fetchTagPosts(selectedTag: String, page: Int) async -> [Post]? {
let resourceFileName = switch page { case 1: "PostList" case 2: "PostListMore" default: "PostListEnd" }
guard let fileLocation = Bundle.main.url(forResource: resourceFileName, withExtension: "json") else {
return nil
}
guard let fileLocation = Bundle(for: type(of: self)).url(forResource: resourceFileName, withExtension: "json") else { return nil }

do {
let mockData = try? Data(contentsOf: fileLocation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ final class PlaybackInteractorTests: XCTestCase {

// Assert
XCTAssertTrue(spy.presentVideoListDidCalled, "displayVideoList는 presentVideoList를 호출하지 않았습니다")
XCTAssertTrue(result, "displayVideoList는 동작에 성공했습니다")
XCTAssertTrue(result, "displayVideoList는 동작에 실패했습니다")
// map이므로 2 + 더미셀 2 = 4
// videoURL이 nil이면 거름
XCTAssertEqual(spy.presentVideoListResponse.videos.count, 4)
Expand Down Expand Up @@ -586,8 +586,9 @@ final class PlaybackInteractorTests: XCTestCase {

// Assert
XCTAssertTrue(spy.presentLoadFetchVideosDidCalled, "fetchPosts가 presentLoadFetchVideos를 호출하지 않았습니다")
XCTAssertEqual(spy.presentLoadFetchVideosResponse.videos.count, 5)
XCTAssertEqual(sut.posts?.count, 8)
XCTAssertTrue(result, "fetchPost에 실패했습니다.")
XCTAssertEqual(spy.presentLoadFetchVideosResponse.videos.count, 1)
XCTAssertEqual(sut.posts?.count, 4)
}

func test_fetchPosts를_호출하면_presentLoadFetchVideos를_호출한다_tag() async {
Expand All @@ -602,8 +603,9 @@ final class PlaybackInteractorTests: XCTestCase {

// Assert
XCTAssertTrue(spy.presentLoadFetchVideosDidCalled, "fetchPosts가 presentLoadFetchVideos를 호출하지 않았습니다")
XCTAssertEqual(spy.presentLoadFetchVideosResponse.videos.count, 4)
XCTAssertEqual(sut.posts?.count, 25)
XCTAssertTrue(result, "fetchPost에 실패했습니다.")
XCTAssertEqual(spy.presentLoadFetchVideosResponse.videos.count, 1)
XCTAssertEqual(sut.posts?.count, 22)
}

func test_fetchPosts를_호출하면_presentLoadFetchVideos를_호출한다_Profile() async {
Expand All @@ -617,7 +619,8 @@ final class PlaybackInteractorTests: XCTestCase {

// Assert
XCTAssertTrue(spy.presentLoadFetchVideosDidCalled, "fetchPosts가 presentLoadFetchVideos를 호출하지 않았습니다")
XCTAssertEqual(spy.presentLoadFetchVideosResponse.videos.count, 4)
XCTAssertEqual(sut.posts?.count, 25)
XCTAssertTrue(result, "fetchPost에 실패했습니다.")
XCTAssertEqual(spy.presentLoadFetchVideosResponse.videos.count, 1)
XCTAssertEqual(sut.posts?.count, 22)
}
}

0 comments on commit ed21d32

Please sign in to comment.