-
-
Notifications
You must be signed in to change notification settings - Fork 752
Expand file tree
/
Copy pathproxy_test.js
More file actions
42 lines (30 loc) · 1.58 KB
/
Copy pathproxy_test.js
File metadata and controls
42 lines (30 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const assert = require('assert');
Feature('Fix for issue #5066: Unable to inject data between workers because of proxy object');
Scenario('Basic share and inject functionality', () => {
console.log('Testing basic share() and inject() functionality...');
// This is the basic pattern that should work after the fix
const originalData = { message: 'Hello', count: 42 };
share(originalData);
const injectedData = inject();
console.log('Shared data keys:', Object.keys(originalData));
console.log('Injected data keys:', Object.keys(injectedData));
// These assertions should pass after the fix
assert.strictEqual(injectedData.message, 'Hello', 'String property should be accessible');
assert.strictEqual(injectedData.count, 42, 'Number property should be accessible');
console.log('✅ SUCCESS: Basic share/inject works!');
});
Scenario('Complex nested data structures', () => {
console.log('Testing complex nested data sharing...');
const testDataJson = {
users: [{ id: 1, name: 'John' }, { id: 2, name: 'Jane' }],
settings: { theme: 'dark', language: 'en' }
};
share({ testDataJson });
const data = inject();
// These should work after the fix
assert(data.testDataJson, 'testDataJson should be accessible');
assert(Array.isArray(data.testDataJson.users), 'users should be an array');
assert.strictEqual(data.testDataJson.users[0].name, 'John', 'Should access nested user data');
assert.strictEqual(data.testDataJson.settings.theme, 'dark', 'Should access nested settings');
console.log('✅ SUCCESS: Complex nested data works!');
});