@@ -35,51 +35,39 @@ function setupServerManager(client = setupClient()) {
35
35
36
36
describe ( "AutoLanguageClient" , ( ) => {
37
37
describe ( "determineProjectPath" , ( ) => {
38
- it ( "returns null when a single file is open" , async ( ) => {
39
- const client = setupClient ( )
40
- const textEditor = ( await atom . workspace . open ( __filename ) ) as TextEditor
41
- /* eslint-disable-next-line dot-notation */
42
- const projectPath = client [ "determineProjectPath" ] ( textEditor )
43
- expect ( projectPath ) . toBeNull ( )
44
- } )
45
- it ( "returns the project path when a file of that project is open" , async ( ) => {
46
- // macos has issues with handling too much resources
47
- if ( process . platform === "darwin" ) {
48
- return
49
- }
38
+ it ( "returns the project path for an internal or an external file in the project" , async ( ) => {
50
39
const client = setupClient ( )
51
40
const serverManager = setupServerManager ( client )
52
41
42
+ // "returns null when a single file is open"
43
+
44
+ let textEditor = ( await atom . workspace . open ( __filename ) ) as TextEditor
45
+ /* eslint-disable-next-line dot-notation */
46
+ expect ( client [ "determineProjectPath" ] ( textEditor ) ) . toBeNull ( )
47
+ textEditor . destroy ( )
48
+
49
+ // "returns the project path when a file of that project is open"
53
50
const projectPath = __dirname
54
51
55
52
// gives the open workspace folder
56
53
atom . project . addPath ( projectPath )
57
54
await serverManager . startServer ( projectPath )
58
55
59
- const textEditor = ( await atom . workspace . open ( __filename ) ) as TextEditor
56
+ textEditor = ( await atom . workspace . open ( __filename ) ) as TextEditor
60
57
/* eslint-disable-next-line dot-notation */
61
58
expect ( client [ "determineProjectPath" ] ( textEditor ) ) . toBe ( normalizePath ( projectPath ) )
62
- } )
63
- it ( "returns the project path for an external file if it is in additional paths" , async ( ) => {
64
- // macos has issues with handling too much resources
65
- if ( process . platform === "darwin" ) {
66
- return
67
- }
59
+ textEditor . destroy ( )
68
60
69
61
// "returns the project path when an external file is open and it is not in additional paths"
70
62
71
- const client = setupClient ( )
72
- const serverManager = setupServerManager ( client )
73
-
74
- const projectPath = __dirname
75
63
const externalDir = join ( dirname ( projectPath ) , "lib" )
76
64
const externalFile = join ( externalDir , "main.js" )
77
65
78
66
// gives the open workspace folder
79
67
atom . project . addPath ( projectPath )
80
68
await serverManager . startServer ( projectPath )
81
69
82
- let textEditor = ( await atom . workspace . open ( externalFile ) ) as TextEditor
70
+ textEditor = ( await atom . workspace . open ( externalFile ) ) as TextEditor
83
71
/* eslint-disable-next-line dot-notation */
84
72
expect ( client [ "determineProjectPath" ] ( textEditor ) ) . toBeNull ( )
85
73
textEditor . destroy ( )
0 commit comments