Use SignalContext instead of SignalWindow
This commit is contained in:
parent
a70a8a88d6
commit
75dab30367
35 changed files with 180 additions and 231 deletions
|
@ -6,8 +6,8 @@
|
|||
const chai = require('chai');
|
||||
const chaiAsPromised = require('chai-as-promised');
|
||||
|
||||
const { Crypto } = require('../ts/context/Crypto');
|
||||
const { setEnvironment, Environment } = require('../ts/environment');
|
||||
const { Context: SignalContext } = require('../ts/context');
|
||||
const { isValidGuid } = require('../ts/util/isValidGuid');
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
|
@ -18,8 +18,8 @@ const storageMap = new Map();
|
|||
|
||||
// To replicate logic we have on the client side
|
||||
global.window = {
|
||||
SignalContext: undefined,
|
||||
SignalWindow: {
|
||||
SignalContext: {
|
||||
crypto: new Crypto(),
|
||||
log: {
|
||||
info: (...args) => console.log(...args),
|
||||
warn: (...args) => console.warn(...args),
|
||||
|
@ -34,21 +34,6 @@ global.window = {
|
|||
isValidGuid,
|
||||
};
|
||||
|
||||
const fakeIPC = {
|
||||
sendSync(channel) {
|
||||
// See `ts/context/NativeThemeListener.ts`
|
||||
if (channel === 'native-theme:init') {
|
||||
return { shouldUseDarkColors: true };
|
||||
}
|
||||
|
||||
throw new Error(`Unsupported sendSync channel: ${channel}`);
|
||||
},
|
||||
|
||||
on() {},
|
||||
};
|
||||
|
||||
global.window.SignalContext = new SignalContext(fakeIPC);
|
||||
|
||||
// For ducks/network.getEmptyState()
|
||||
global.navigator = {};
|
||||
global.WebSocket = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue