mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-25 02:48:23 +01:00
Qualify CJS-only module imports
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { noop } from 'lodash';
|
||||
import lodash from 'lodash';
|
||||
|
||||
import { AbortableProcess } from '../../util/AbortableProcess.js';
|
||||
|
||||
const { noop } = lodash;
|
||||
|
||||
describe('AbortableProcess', () => {
|
||||
it('resolves the result normally', async () => {
|
||||
const process = new AbortableProcess(
|
||||
|
||||
@@ -9,8 +9,7 @@ import {
|
||||
CallType,
|
||||
GroupCallStatus,
|
||||
} from '../../types/CallDisposition.js';
|
||||
import { setupI18n } from '../../util/setupI18n.js';
|
||||
import enMessages from '../../../_locales/en/messages.json';
|
||||
import i18n from './i18n.js';
|
||||
import {
|
||||
getDefaultConversation,
|
||||
getDefaultGroup,
|
||||
@@ -19,8 +18,6 @@ import { getPeerIdFromConversation } from '../../util/callDisposition.js';
|
||||
import { HOUR } from '../../util/durations/index.js';
|
||||
|
||||
describe('calling notification helpers', () => {
|
||||
const i18n = setupI18n('en', enMessages);
|
||||
|
||||
describe('getCallingNotificationText', () => {
|
||||
// Direct call behavior is not tested here.
|
||||
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { pick } from 'lodash';
|
||||
import lodash from 'lodash';
|
||||
import { getDefaultConversation } from '../../test-helpers/getDefaultConversation.js';
|
||||
import { filterAndSortConversations } from '../../util/filterAndSortConversations.js';
|
||||
import type { ConversationType } from '../../state/ducks/conversations.js';
|
||||
|
||||
const { pick } = lodash;
|
||||
|
||||
type CheckProps = Pick<ConversationType, 'title' | 'activeAt' | 'e164'>;
|
||||
|
||||
function check({
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
import { assert } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import { setupI18n } from '../../util/setupI18n.js';
|
||||
import enMessages from '../../../_locales/en/messages.json';
|
||||
import i18n from './i18n.js';
|
||||
|
||||
import { getMuteOptions } from '../../util/getMuteOptions.js';
|
||||
|
||||
@@ -35,8 +34,6 @@ describe('getMuteOptions', () => {
|
||||
},
|
||||
];
|
||||
|
||||
const i18n = setupI18n('en', enMessages);
|
||||
|
||||
describe('when not muted', () => {
|
||||
it('returns the 5 default options', () => {
|
||||
assert.deepStrictEqual(
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
|
||||
import { assert } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import { setupI18n } from '../../util/setupI18n.js';
|
||||
import enMessages from '../../../_locales/en/messages.json';
|
||||
import i18n from './i18n.js';
|
||||
|
||||
import { getMutedUntilText } from '../../util/getMutedUntilText.js';
|
||||
|
||||
describe('getMutedUntilText', () => {
|
||||
const i18n = setupI18n('en', enMessages);
|
||||
|
||||
let sandbox: sinon.SinonSandbox;
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
import { assert } from 'chai';
|
||||
import { Readable } from 'node:stream';
|
||||
import * as sinon from 'sinon';
|
||||
import { noop } from 'lodash';
|
||||
import lodash from 'lodash';
|
||||
import { once } from 'node:events';
|
||||
|
||||
import { getStreamWithTimeout } from '../../util/getStreamWithTimeout.js';
|
||||
|
||||
const { noop } = lodash;
|
||||
|
||||
describe('getStreamWithTimeout', () => {
|
||||
let sandbox: sinon.SinonSandbox;
|
||||
let clock: sinon.SinonFakeTimers;
|
||||
|
||||
21
ts/test-node/util/i18n.ts
Normal file
21
ts/test-node/util/i18n.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { setupI18n } from '../../util/setupI18n.js';
|
||||
|
||||
const PATH = join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'_locales',
|
||||
'en',
|
||||
'messages.json'
|
||||
);
|
||||
|
||||
export const enMessages = JSON.parse(readFileSync(PATH, 'utf8'));
|
||||
|
||||
export default setupI18n('en', enMessages);
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { mapValues, pick } from 'lodash';
|
||||
import lodash from 'lodash';
|
||||
|
||||
import type { CustomError } from '../../textsecure/Types.js';
|
||||
|
||||
@@ -25,6 +25,8 @@ import {
|
||||
} from '../../services/notifications.js';
|
||||
import type { MessageModel } from '../../models/messages.js';
|
||||
|
||||
const { mapValues, pick } = lodash;
|
||||
|
||||
const log = createLogger('messageFailures');
|
||||
|
||||
export async function saveErrorsOnMessage(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { times } from 'lodash';
|
||||
import lodash from 'lodash';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import type { LastMessageStatus } from '../../model-types.d.ts';
|
||||
import { MINUTE, SECOND } from '../../util/durations/index.js';
|
||||
@@ -15,6 +15,8 @@ import {
|
||||
TimelineMessageLoadingState,
|
||||
} from '../../util/timelineUtil.js';
|
||||
|
||||
const { times } = lodash;
|
||||
|
||||
describe('<Timeline> utilities', () => {
|
||||
describe('areMessagesInSameGroup', () => {
|
||||
const defaultNewer: MaybeMessageTimelineItemType = {
|
||||
|
||||
@@ -5,8 +5,7 @@ import { assert } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import moment from 'moment';
|
||||
import { HOUR, DAY } from '../../util/durations/index.js';
|
||||
import { setupI18n } from '../../util/setupI18n.js';
|
||||
import enMessages from '../../../_locales/en/messages.json';
|
||||
import i18n from './i18n.js';
|
||||
|
||||
import {
|
||||
formatDate,
|
||||
@@ -36,8 +35,6 @@ describe('timestamp', () => {
|
||||
});
|
||||
}
|
||||
|
||||
const i18n = setupI18n('en', enMessages);
|
||||
|
||||
describe('formatDate', () => {
|
||||
useFakeTimers();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { assert } from 'chai';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { ServerPublicParams } from '@signalapp/libsignal-client/zkgroup';
|
||||
import { ServerPublicParams } from '@signalapp/libsignal-client/zkgroup.js';
|
||||
|
||||
describe('zkgroup', () => {
|
||||
describe('serverPublicParams', () => {
|
||||
|
||||
Reference in New Issue
Block a user