]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix path comparison in api-ipc-spec
authorEran Tiktin <eran.t@mce-sys.com>
Sat, 22 Aug 2015 16:50:54 +0000 (19:50 +0300)
committerEran Tiktin <eran.t@mce-sys.com>
Sat, 22 Aug 2015 16:50:54 +0000 (19:50 +0300)
One of the tests failed because in one of the paths the drive letter was
upper case `C` and in the other it was lower case `c`.
Paths in Windows are case insensitive, so this shouldn't fail. The fix
was to lower case the paths before comparison (only on Windows).

spec/api-ipc-spec.coffee

index 7c6148b559b0445e6644c5983f336a537291a591..142f06c00ff336e576438aa7427bd7c682f6fb3d 100644 (file)
@@ -5,6 +5,13 @@ remote = require 'remote'
 
 BrowserWindow = remote.require 'browser-window'
 
+comparePaths = (path1, path2) ->
+  if process.platform is 'win32'
+    # Paths in Windows are case insensitive.
+    path1 = path1.toLowerCase()
+    path2 = path2.toLowerCase()
+  assert.equal path1, path2
+
 describe 'ipc module', ->
   fixtures = path.join __dirname, 'fixtures'
 
@@ -19,8 +26,8 @@ describe 'ipc module', ->
       assert.equal a.id, 1127
 
     it 'should search module from the user app', ->
-      assert.equal path.normalize(remote.process.mainModule.filename), path.resolve(__dirname, 'static', 'main.js')
-      assert.equal path.normalize(remote.process.mainModule.paths[0]), path.resolve(__dirname, 'static', 'node_modules')
+      comparePaths path.normalize(remote.process.mainModule.filename), path.resolve(__dirname, 'static', 'main.js')
+      comparePaths path.normalize(remote.process.mainModule.paths[0]), path.resolve(__dirname, 'static', 'node_modules')
 
   describe 'remote.createFunctionWithReturnValue', ->
     it 'should be called in browser synchronously', ->