Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit a45647a

Browse files
committed
Add HistoryViewCoordinatorTests
1 parent c986bce commit a45647a

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

DuckDuckGo-macOS.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,8 @@
11901190
37598EF82D5A1D5800720EAF /* HistoryViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37598EF62D5A1D5500720EAF /* HistoryViewCoordinator.swift */; };
11911191
37598EFA2D5A278400720EAF /* ArrayExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37598EF92D5A278100720EAF /* ArrayExtensionTests.swift */; };
11921192
37598EFB2D5A278400720EAF /* ArrayExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37598EF92D5A278100720EAF /* ArrayExtensionTests.swift */; };
1193+
37598EFD2D5A33DA00720EAF /* HistoryViewCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37598EFC2D5A33D200720EAF /* HistoryViewCoordinatorTests.swift */; };
1194+
37598EFE2D5A33DA00720EAF /* HistoryViewCoordinatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37598EFC2D5A33D200720EAF /* HistoryViewCoordinatorTests.swift */; };
11931195
376113CC2B29CD5B00E794BB /* CriticalPathsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565E46DF2B2725DD0013AC2A /* CriticalPathsTests.swift */; };
11941196
376705AF27EB488600DD8D76 /* RoundedSelectionRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B0511B3262CAA5A00F6079C /* RoundedSelectionRowView.swift */; };
11951197
376731822C7E226A00EB097B /* HomePageViewBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376731812C7E226A00EB097B /* HomePageViewBackground.swift */; };
@@ -3825,6 +3827,7 @@
38253827
37598EF32D5A18FB00720EAF /* HistoryViewPixel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryViewPixel.swift; sourceTree = "<group>"; };
38263828
37598EF62D5A1D5500720EAF /* HistoryViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryViewCoordinator.swift; sourceTree = "<group>"; };
38273829
37598EF92D5A278100720EAF /* ArrayExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayExtensionTests.swift; sourceTree = "<group>"; };
3830+
37598EFC2D5A33D200720EAF /* HistoryViewCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryViewCoordinatorTests.swift; sourceTree = "<group>"; };
38283831
376113C52B29BCD600E794BB /* SyncE2EUITests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SyncE2EUITests.xcconfig; sourceTree = "<group>"; };
38293832
376113D42B29CD5B00E794BB /* SyncE2EUITests App Store.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SyncE2EUITests App Store.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
38303833
376113D72B29D0F800E794BB /* SyncE2EUITestsAppStore.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SyncE2EUITestsAppStore.xcconfig; sourceTree = "<group>"; };
@@ -9291,6 +9294,7 @@
92919294
AAEC74B02642C48B00C2EFBC /* Services */ = {
92929295
isa = PBXGroup;
92939296
children = (
9297+
37598EFC2D5A33D200720EAF /* HistoryViewCoordinatorTests.swift */,
92949298
3745DE072D536EF000024FC8 /* HistoryGroupingProviderTests.swift */,
92959299
AAEC74B52642CC6A00C2EFBC /* HistoryStoringMock.swift */,
92969300
AAEC74B72642E43800C2EFBC /* HistoryStoreTests.swift */,
@@ -12790,6 +12794,7 @@
1279012794
1DB9617B29F1D06D00CF5568 /* InternalUserDeciderMock.swift in Sources */,
1279112795
F1F861172C1B25D4005DB446 /* SubscriptionUIHandlerMock.swift in Sources */,
1279212796
317295D52AF058D3002C3206 /* MockWaitlistFeatureSetupHandler.swift in Sources */,
12797+
37598EFD2D5A33DA00720EAF /* HistoryViewCoordinatorTests.swift in Sources */,
1279312798
3706FE49293F661700E42796 /* BookmarkNodePathTests.swift in Sources */,
1279412799
1DE03425298BC7F000CAB3D7 /* InternalUserDeciderStoreMock.swift in Sources */,
1279512800
3706FE4A293F661700E42796 /* BookmarkManagedObjectTests.swift in Sources */,
@@ -14329,6 +14334,7 @@
1432914334
B6619F062B17138D00CD9186 /* DataImportSourceViewModelTests.swift in Sources */,
1433014335
4BBF0917282DD6EF00EE1418 /* TemporaryFileHandlerTests.swift in Sources */,
1433114336
B6A5A27925B93FFF00AA7ADA /* StateRestorationManagerTests.swift in Sources */,
14337+
37598EFE2D5A33DA00720EAF /* HistoryViewCoordinatorTests.swift in Sources */,
1433214338
9F982F132B822B7B00231028 /* AddEditBookmarkFolderDialogViewModelTests.swift in Sources */,
1433314339
B630E7FE29C887ED00363609 /* NSErrorAdditionalInfo.swift in Sources */,
1433414340
370270C02C78EB13002E44E4 /* HomePageSettingsModelTests.swift in Sources */,
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// HistoryViewCoordinatorTests.swift
3+
//
4+
// Copyright © 2025 DuckDuckGo. All rights reserved.
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
19+
import HistoryView
20+
import PixelKit
21+
import XCTest
22+
@testable import DuckDuckGo_Privacy_Browser
23+
24+
final class HistoryViewCoordinatorTests: XCTestCase {
25+
var coordinator: HistoryViewCoordinator!
26+
var notificationCenter: NotificationCenter!
27+
var firePixelCalls: [PixelKitEvent] = []
28+
29+
@MainActor
30+
override func setUp() async throws {
31+
try await super.setUp()
32+
33+
notificationCenter = NotificationCenter()
34+
firePixelCalls.removeAll()
35+
36+
coordinator = HistoryViewCoordinator(
37+
historyCoordinator: MockHistoryGroupingDataSource(),
38+
notificationCenter: notificationCenter,
39+
fireDailyPixel: { self.firePixelCalls.append($0) }
40+
)
41+
}
42+
43+
func testWhenHistoryViewAppearsThenPixelIsSent() {
44+
notificationCenter.post(name: .historyWebViewDidAppear, object: nil)
45+
XCTAssertEqual(firePixelCalls.count, 1)
46+
}
47+
}

0 commit comments

Comments
 (0)