@@ -9,14 +9,14 @@ import ManagerSettings from '../../../../../src/r2mm/manager/ManagerSettings';
9
9
import FileUtils from '../../../../../src/utils/FileUtils' ;
10
10
import GameDirectoryResolverProvider from '../../../../../src/providers/ror2/game/GameDirectoryResolverProvider' ;
11
11
import { ManagerSettingsInterfaceHolder } from '../../../../../src/r2mm/manager/SettingsDexieStore' ;
12
- import InMemoryFsProvider from " ../../../stubs/providers/InMemory.FsProvider" ;
13
- import SettingsRedirectGameDirectoryResolver from " ../../../stubs/providers/SettingsRedirectGameDirectoryResolver" ;
12
+ import InMemoryFsProvider from ' ../../../stubs/providers/InMemory.FsProvider' ;
13
+ import SettingsRedirectGameDirectoryResolver from ' ../../../stubs/providers/SettingsRedirectGameDirectoryResolver' ;
14
14
import { describe , beforeAll , test , expect } from 'vitest' ;
15
15
import { providePathImplementation } from '../../../../../src/providers/node/path/path' ;
16
16
import { TestPathProvider } from '../../../stubs/providers/node/Node.Path.Provider' ;
17
17
import { provideAppWindowImplementation } from '../../../../../src/providers/node/app/app_window' ;
18
18
import { TestAppWindowProvider } from '../../../stubs/providers/node/AppWindow.Provider' ;
19
- 2
19
+
20
20
class ProfileProviderImpl extends ProfileProvider {
21
21
ensureProfileDirectory ( directory : string , profile : string ) : void {
22
22
FsProvider . instance . mkdirs ( path . join ( directory , profile ) ) ;
@@ -28,7 +28,7 @@ describe.skipIf(process.platform !== 'win32')('ModLinker', async () => {
28
28
let settings ! : ManagerSettings ;
29
29
30
30
beforeAll ( async ( ) => {
31
- providePathImplementation ( ( ) => TestPathProvider ) ;
31
+ providePathImplementation ( ( ) => TestPathProvider ) ;
32
32
provideAppWindowImplementation ( ( ) => TestAppWindowProvider ) ;
33
33
34
34
new Profile ( 'TestProfile' ) ;
@@ -46,32 +46,32 @@ describe.skipIf(process.platform !== 'win32')('ModLinker', async () => {
46
46
// Hack to work around Dexie loading issue during test
47
47
( ManagerSettings [ 'CONTEXT' ] as any ) = ( {
48
48
global : {
49
- steamDirectory : " TEST_STEAM_PATH"
49
+ steamDirectory : ' TEST_STEAM_PATH'
50
50
} ,
51
51
gameSpecific : {
52
- gameDirectory : " TEST_GAME_DIRECTORY"
52
+ gameDirectory : ' TEST_GAME_DIRECTORY'
53
53
}
54
- } as ManagerSettingsInterfaceHolder )
54
+ } as ManagerSettingsInterfaceHolder ) ;
55
55
// await settings.setGameDirectory("GAME_DIR");
56
56
await FileUtils . ensureDirectory ( settings . getContext ( ) . gameSpecific . gameDirectory ! ) ;
57
57
} ) ;
58
58
59
59
test ( 'Install, no existing files' , async ( ) => {
60
- const testFile = Profile . getActiveProfile ( ) . joinToProfilePath ( " test_file" ) ;
61
- await FsProvider . instance . writeFile ( testFile , " content" ) ;
62
- expect ( await FsProvider . instance . exists ( path . join ( settings . getContext ( ) . gameSpecific . gameDirectory ! , " test_file" ) ) ) . toBeFalsy ( ) ;
60
+ const testFile = Profile . getActiveProfile ( ) . joinToProfilePath ( ' test_file' ) ;
61
+ await FsProvider . instance . writeFile ( testFile , ' content' ) ;
62
+ expect ( await FsProvider . instance . exists ( path . join ( settings . getContext ( ) . gameSpecific . gameDirectory ! , ' test_file' ) ) ) . toBeFalsy ( ) ;
63
63
await ModLinker . link ( Profile . getActiveAsImmutableProfile ( ) , GameManager . defaultGame ) ;
64
- expect ( await FsProvider . instance . exists ( path . join ( settings . getContext ( ) . gameSpecific . gameDirectory ! , " test_file" ) ) ) . toBeTruthy ( ) ;
64
+ expect ( await FsProvider . instance . exists ( path . join ( settings . getContext ( ) . gameSpecific . gameDirectory ! , ' test_file' ) ) ) . toBeTruthy ( ) ;
65
65
} ) ;
66
66
67
67
test ( 'Install, file already exists, no overwrite' , async ( ) => {
68
- const testFile = Profile . getActiveProfile ( ) . joinToProfilePath ( " test_file" ) ;
68
+ const testFile = Profile . getActiveProfile ( ) . joinToProfilePath ( ' test_file' ) ;
69
69
expect ( await FsProvider . instance . exists ( testFile ) ) . toBeTruthy ( ) ;
70
70
const oldStat = await FsProvider . instance . stat ( testFile ) ;
71
71
await new Promise ( resolve => {
72
72
setTimeout ( async ( ) => {
73
73
await ModLinker . link ( Profile . getActiveAsImmutableProfile ( ) , GameManager . defaultGame ) ;
74
- expect ( await FsProvider . instance . exists ( path . join ( settings . getContext ( ) . gameSpecific . gameDirectory ! , " test_file" ) ) ) . toBeTruthy ( ) ;
74
+ expect ( await FsProvider . instance . exists ( path . join ( settings . getContext ( ) . gameSpecific . gameDirectory ! , ' test_file' ) ) ) . toBeTruthy ( ) ;
75
75
const newStat = await FsProvider . instance . stat ( testFile ) ;
76
76
expect ( newStat . mtime ) . toEqual ( oldStat . mtime ) ;
77
77
resolve ( undefined ) ;
@@ -80,14 +80,14 @@ describe.skipIf(process.platform !== 'win32')('ModLinker', async () => {
80
80
} ) ;
81
81
82
82
test ( 'Install, file already exists, overwritten' , async ( ) => {
83
- const testFile = Profile . getActiveProfile ( ) . joinToProfilePath ( " test_file" ) ;
83
+ const testFile = Profile . getActiveProfile ( ) . joinToProfilePath ( ' test_file' ) ;
84
84
expect ( await FsProvider . instance . exists ( testFile ) ) . toBeTruthy ( ) ;
85
85
const oldStat = await FsProvider . instance . stat ( testFile ) ;
86
- await FsProvider . instance . writeFile ( testFile , " modified" ) ;
86
+ await FsProvider . instance . writeFile ( testFile , ' modified' ) ;
87
87
await new Promise ( resolve => {
88
88
setTimeout ( async ( ) => {
89
89
await ModLinker . link ( Profile . getActiveAsImmutableProfile ( ) , GameManager . defaultGame ) ;
90
- expect ( await FsProvider . instance . exists ( path . join ( settings . getContext ( ) . gameSpecific . gameDirectory ! , " test_file" ) ) ) . toBeTruthy ( ) ;
90
+ expect ( await FsProvider . instance . exists ( path . join ( settings . getContext ( ) . gameSpecific . gameDirectory ! , ' test_file' ) ) ) . toBeTruthy ( ) ;
91
91
const newStat = await FsProvider . instance . stat ( testFile ) ;
92
92
expect ( newStat . mtime ) . not . toEqual ( oldStat . mtime ) ;
93
93
resolve ( undefined ) ;
0 commit comments