From d2d31783900de64e2b2656ae6a678f9decf24e40 Mon Sep 17 00:00:00 2001 From: Tatsumi0000 <19218690+Tatsumi0000@users.noreply.github.com> Date: Thu, 18 Apr 2024 21:43:43 +0900 Subject: [PATCH] Create WordListFileRepositoryTests --- .../WordListFileRepositoryTests.swift | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 RaelizeLogic/Tests/RaelizeLogicTests/Repository/WordListFileRepositoryTests.swift diff --git a/RaelizeLogic/Tests/RaelizeLogicTests/Repository/WordListFileRepositoryTests.swift b/RaelizeLogic/Tests/RaelizeLogicTests/Repository/WordListFileRepositoryTests.swift new file mode 100644 index 0000000..5adae40 --- /dev/null +++ b/RaelizeLogic/Tests/RaelizeLogicTests/Repository/WordListFileRepositoryTests.swift @@ -0,0 +1,48 @@ +// +// WordListFileRepositoryTests.swift +// +// Created by Tatsumi0000 on 2024/04/18 +// +// + +import Combine +import Foundation +import Testing + +@testable import RaelizeLogic + +final class WordListFileRepositoryTests { + + private let repository: any WordListFileRepositoryType + private var cancellables: Set = [] + + init() { + self.repository = RepositoryProvider.shared.wordListFileRepository + } + + deinit { + + } + + @Test + func readFile() { + self.repository.readFile(fileName: "a") + self.repository.getWordList() + .sink(receiveValue: { words in + #expect(!words!.isEmpty) + }) + .store(in: &cancellables) + } + + @Test + func resetFile() { + self.repository.readFile(fileName: "a") + self.repository.resetFile() + self.repository.getWordList() + .sink(receiveValue: { words in + #expect(words == nil) + }) + .store(in: &cancellables) + } + +}