signal-desktop/test/setup-test-node.js
2021-04-09 11:19:38 -05:00

28 lines
738 B
JavaScript

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
/* eslint-disable no-console */
const ByteBuffer = require('../components/bytebuffer/dist/ByteBufferAB.js');
const Long = require('../components/long/dist/Long.js');
const { setEnvironment, Environment } = require('../ts/environment');
setEnvironment(Environment.Test);
// To replicate logic we have on the client side
global.window = {
log: {
info: (...args) => console.log(...args),
warn: (...args) => console.warn(...args),
error: (...args) => console.error(...args),
},
i18n: key => `i18n(${key})`,
dcodeIO: {
ByteBuffer,
Long,
},
};
// For ducks/network.getEmptyState()
global.navigator = {};
global.WebSocket = {};