Skip to content

Commit 8f85317

Browse files
author
Thomas Krause
committed
Fix failing unit tests on non-german systems and for user names with spaces in them
1 parent cc9af0f commit 8f85317

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

test/NodeJS/NodeJSServiceImplementations/OutOfProcess/Http/HttpNodeJSPoolServiceIntegrationTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Linq;
1010
using System.Net.Http;
1111
using System.Text;
12+
using System.Text.Encodings.Web;
1213
using System.Text.RegularExpressions;
1314
using System.Threading;
1415
using System.Threading.Tasks;
@@ -93,7 +94,7 @@ public async void FileWatching_RespectsGracefulShutdownOptionWhenItsTrue()
9394
const int dummyNumProcesses = 5;
9495
Uri tempWatchDirectoryUri = CreateWatchDirectoryUri();
9596
// Create initial module
96-
string dummylongRunningTriggerPath = new Uri(tempWatchDirectoryUri, "dummyTriggerFile").AbsolutePath; // fs.watch can't deal with backslashes in paths
97+
string dummylongRunningTriggerPath = new Uri(tempWatchDirectoryUri, "dummyTriggerFile").LocalPath;
9798
#if NET461
9899
File.WriteAllText(dummylongRunningTriggerPath, string.Empty); // fs.watch returns immediately if path to watch doesn't exist
99100
#else
@@ -102,15 +103,15 @@ public async void FileWatching_RespectsGracefulShutdownOptionWhenItsTrue()
102103
string dummyInitialModule = $@"module.exports = {{
103104
getPid: (callback) => callback(null, process.pid),
104105
longRunning: (callback) => {{
105-
fs.watch('{dummylongRunningTriggerPath}',
106+
fs.watch('{JavaScriptEncoder.Default.Encode(dummylongRunningTriggerPath)}',
106107
null,
107108
() => {{
108109
callback(null, process.pid);
109110
}}
110111
);
111112
}}
112113
}}";
113-
string dummyModuleFilePath = new Uri(tempWatchDirectoryUri, "dummyModule.js").AbsolutePath;
114+
string dummyModuleFilePath = new Uri(tempWatchDirectoryUri, "dummyModule.js").LocalPath;
114115
#if NET461
115116
File.WriteAllText(dummyModuleFilePath, dummyInitialModule);
116117
#else
@@ -194,7 +195,7 @@ public async void FileWatching_RespectsGracefulShutdownOptionWhenItsFalse()
194195
getPid: (callback) => callback(null, process.pid),
195196
longRunning: (callback) => setInterval(() => { /* Do nothing */ }, 1000)
196197
}";
197-
string dummyModuleFilePath = new Uri(CreateWatchDirectoryUri(), "dummyModule.js").AbsolutePath;
198+
string dummyModuleFilePath = new Uri(CreateWatchDirectoryUri(), "dummyModule.js").LocalPath;
198199
#if NET461
199200
File.WriteAllText(dummyModuleFilePath, dummyInitialModule);
200201
#else

test/NodeJS/NodeJSServiceImplementations/OutOfProcess/OutOfProcessNodeJSServiceUnitTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ public async void TryInvokeCoreAsync_ThrowsObjectDisposedExceptionIfObjectHasBee
462462
mockTestSubject.Object.Dispose();
463463
ObjectDisposedException result = await Assert.
464464
ThrowsAsync<ObjectDisposedException>(async () => await mockTestSubject.Object.TryInvokeCoreAsync<string>(new InvocationRequest(ModuleSourceType.String, "dummyModuleSource"), CancellationToken.None).ConfigureAwait(false)).ConfigureAwait(false);
465-
Assert.Equal($"Cannot access a disposed object.\nObject name: '{nameof(OutOfProcessNodeJSService)}'.", result.Message, ignoreLineEndingDifferences: true);
465+
Assert.Contains($"{nameof(OutOfProcessNodeJSService)}", result.Message);
466466
}
467467

468468
[Fact]

0 commit comments

Comments
 (0)