11import { describe , it , expect , beforeEach , afterAll , vi } from "vitest" ;
2- import * as Config from "../../src/ts/config" ;
2+ import * as Config from "../../src/ts/config/setters" ;
3+ import * as Lifecycle from "../../src/ts/config/lifecycle" ;
4+ import * as ConfigUtils from "../../src/ts/config/utils" ;
5+ import { __testing } from "../../src/ts/config/testing" ;
36import * as Misc from "../../src/ts/utils/misc" ;
47import * as Env from "../../src/ts/utils/env" ;
58import {
69 ConfigKey ,
710 Config as ConfigType ,
811 CaretStyleSchema ,
912} from "@monkeytype/schemas/configs" ;
10- import * as FunboxValidation from "../../src/ts/test/funbox /funbox-validation" ;
11- import * as ConfigValidation from "../../src/ts/config- validation" ;
12- import * as ConfigEvent from "../../src/ts/observables /config-event " ;
13+ import * as FunboxValidation from "../../src/ts/config /funbox-validation" ;
14+ import * as ConfigValidation from "../../src/ts/config/ validation" ;
15+ import { configEvent } from "../../src/ts/events /config" ;
1316import * as ApeConfig from "../../src/ts/ape/config" ;
1417import * as Notifications from "../../src/ts/states/notifications" ;
15- const { replaceConfig, getConfig } = Config . __testing ;
18+ const { replaceConfig, getConfig } = __testing ;
1619
1720describe ( "Config" , ( ) => {
1821 const isDevEnvironmentMock = vi . spyOn ( Env , "isDevEnvironment" ) ;
@@ -30,7 +33,7 @@ describe("Config", () => {
3033 ConfigValidation ,
3134 "isConfigValueValid" ,
3235 ) ;
33- const dispatchConfigEventMock = vi . spyOn ( ConfigEvent , "dispatch" ) ;
36+ const dispatchConfigEventMock = vi . spyOn ( configEvent , "dispatch" ) ;
3437 const dbSaveConfigMock = vi . spyOn ( ApeConfig , "saveConfig" ) ;
3538 const notificationAddMock = vi . spyOn (
3639 Notifications ,
@@ -281,7 +284,7 @@ describe("Config", () => {
281284 replaceConfig ( {
282285 mode : "words" ,
283286 } ) ;
284- await Config . applyConfig ( {
287+ await Lifecycle . applyConfig ( {
285288 numbers : true ,
286289 punctuation : true ,
287290 } ) ;
@@ -326,7 +329,7 @@ describe("Config", () => {
326329 ] ;
327330
328331 it . each ( testCases ) ( "$display" , async ( { value, expected } ) => {
329- await Config . applyConfig ( value ) ;
332+ await Lifecycle . applyConfig ( value ) ;
330333
331334 const config = getConfig ( ) ;
332335 const applied = Object . fromEntries (
@@ -363,7 +366,7 @@ describe("Config", () => {
363366 ] ;
364367
365368 it . each ( testCases ) ( "$display" , async ( { value, expected } ) => {
366- await Config . applyConfig ( value ) ;
369+ await Lifecycle . applyConfig ( value ) ;
367370 const config = getConfig ( ) ;
368371 const applied = Object . fromEntries (
369372 Object . entries ( config ) . filter ( ( [ key ] ) =>
@@ -378,8 +381,8 @@ describe("Config", () => {
378381 replaceConfig ( {
379382 numbers : true ,
380383 } ) ;
381- await Config . applyConfig ( {
382- ...Config . getConfigChanges ( ) ,
384+ await Lifecycle . applyConfig ( {
385+ ...ConfigUtils . getConfigChanges ( ) ,
383386 punctuation : true ,
384387 } ) ;
385388 const config = getConfig ( ) ;
@@ -390,7 +393,7 @@ describe("Config", () => {
390393 replaceConfig ( {
391394 minWpm : "off" ,
392395 } ) ;
393- await Config . applyConfig ( {
396+ await Lifecycle . applyConfig ( {
394397 minWpmCustomSpeed : 100 ,
395398 } ) ;
396399 const config = getConfig ( ) ;
@@ -402,7 +405,7 @@ describe("Config", () => {
402405 replaceConfig ( {
403406 minWpm : "off" ,
404407 } ) ;
405- await Config . applyConfig ( {
408+ await Lifecycle . applyConfig ( {
406409 minWpm : "custom" ,
407410 minWpmCustomSpeed : 100 ,
408411 } ) ;
@@ -413,7 +416,7 @@ describe("Config", () => {
413416
414417 it ( "should keep the keymap off when applying keymapLayout" , async ( ) => {
415418 replaceConfig ( { } ) ;
416- await Config . applyConfig ( {
419+ await Lifecycle . applyConfig ( {
417420 keymapLayout : "qwerty" ,
418421 } ) ;
419422 const config = getConfig ( ) ;
0 commit comments