@@ -9,7 +9,7 @@ import * as ConfigUtils from "../../src/ts/config/utils";
99import * as Persistence from "../../src/ts/config/persistence" ;
1010import * as Notifications from "../../src/ts/states/notifications" ;
1111import * as TestLogic from "../../src/ts/test/test-logic" ;
12- import * as TagController from "../../src/ts/controllers/tag-controller " ;
12+ import * as Tags from "../../src/ts/collections/tags " ;
1313
1414describe ( "PresetController" , ( ) => {
1515 describe ( "apply" , ( ) => {
@@ -34,12 +34,9 @@ describe("PresetController", () => {
3434 "showSuccessNotification" ,
3535 ) ;
3636 const testRestartMock = vi . spyOn ( TestLogic , "restart" ) ;
37- const tagControllerClearMock = vi . spyOn ( TagController , "clear" ) ;
38- const tagControllerSetMock = vi . spyOn ( TagController , "set" ) ;
39- const tagControllerSaveActiveMock = vi . spyOn (
40- TagController ,
41- "saveActiveToLocalStorage" ,
42- ) ;
37+ const tagsClearMock = vi . spyOn ( Tags , "clearActiveTags" ) ;
38+ const tagsSetMock = vi . spyOn ( Tags , "setTagActive" ) ;
39+ const tagsSaveActiveMock = vi . spyOn ( Tags , "saveActiveToLocalStorage" ) ;
4340
4441 beforeEach ( ( ) => {
4542 [
@@ -49,9 +46,9 @@ describe("PresetController", () => {
4946 configGetConfigChangesMock ,
5047 notificationAddMock ,
5148 testRestartMock ,
52- tagControllerClearMock ,
53- tagControllerSetMock ,
54- tagControllerSaveActiveMock ,
49+ tagsClearMock ,
50+ tagsSetMock ,
51+ tagsSaveActiveMock ,
5552 ] . forEach ( ( it ) => it . mockClear ( ) ) ;
5653
5754 configApplyMock . mockResolvedValue ( ) ;
@@ -66,7 +63,7 @@ describe("PresetController", () => {
6663
6764 //THEN
6865 expect ( configApplyMock ) . toHaveBeenCalledWith ( preset . config ) ;
69- expect ( tagControllerClearMock ) . toHaveBeenCalled ( ) ;
66+ expect ( tagsClearMock ) . toHaveBeenCalled ( ) ;
7067 expect ( testRestartMock ) . toHaveBeenCalled ( ) ;
7168 expect ( notificationAddMock ) . toHaveBeenCalledWith ( "Preset applied" , {
7269 durationMs : 2000 ,
@@ -84,20 +81,10 @@ describe("PresetController", () => {
8481 await PresetController . apply ( preset . _id ) ;
8582
8683 //THEN
87- expect ( tagControllerClearMock ) . toHaveBeenCalled ( ) ;
88- expect ( tagControllerSetMock ) . toHaveBeenNthCalledWith (
89- 1 ,
90- "tagOne" ,
91- true ,
92- false ,
93- ) ;
94- expect ( tagControllerSetMock ) . toHaveBeenNthCalledWith (
95- 2 ,
96- "tagTwo" ,
97- true ,
98- false ,
99- ) ;
100- expect ( tagControllerSaveActiveMock ) . toHaveBeenCalled ( ) ;
84+ expect ( tagsClearMock ) . toHaveBeenCalled ( ) ;
85+ expect ( tagsSetMock ) . toHaveBeenNthCalledWith ( 1 , "tagOne" , true , false ) ;
86+ expect ( tagsSetMock ) . toHaveBeenNthCalledWith ( 2 , "tagTwo" , true , false ) ;
87+ expect ( tagsSaveActiveMock ) . toHaveBeenCalled ( ) ;
10188 } ) ;
10289
10390 it ( "should ignore unknown preset" , async ( ) => {
@@ -145,20 +132,10 @@ describe("PresetController", () => {
145132 await PresetController . apply ( preset . _id ) ;
146133
147134 //THEN
148- expect ( tagControllerClearMock ) . toHaveBeenCalled ( ) ;
149- expect ( tagControllerSetMock ) . toHaveBeenNthCalledWith (
150- 1 ,
151- "tagOne" ,
152- true ,
153- false ,
154- ) ;
155- expect ( tagControllerSetMock ) . toHaveBeenNthCalledWith (
156- 2 ,
157- "tagTwo" ,
158- true ,
159- false ,
160- ) ;
161- expect ( tagControllerSaveActiveMock ) . toHaveBeenCalled ( ) ;
135+ expect ( tagsClearMock ) . toHaveBeenCalled ( ) ;
136+ expect ( tagsSetMock ) . toHaveBeenNthCalledWith ( 1 , "tagOne" , true , false ) ;
137+ expect ( tagsSetMock ) . toHaveBeenNthCalledWith ( 2 , "tagTwo" , true , false ) ;
138+ expect ( tagsSaveActiveMock ) . toHaveBeenCalled ( ) ;
162139 } ) ;
163140
164141 const givenPreset = ( partialPreset : Partial < Preset > ) : Preset => {
0 commit comments