Prepare for adding file suffixes

This commit is contained in:
Fedor Indutny
2025-10-16 11:29:11 -07:00
parent 3330dd72ce
commit 3387cf6a77
2095 changed files with 15148 additions and 14629 deletions

View File

@@ -4,7 +4,7 @@
import { assert } from 'chai';
import lodash from 'lodash';
import { AbortableProcess } from '../../util/AbortableProcess.js';
import { AbortableProcess } from '../../util/AbortableProcess.std.js';
const { noop } = lodash;

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { BackOff } from '../../util/BackOff.js';
import { BackOff } from '../../util/BackOff.std.js';
describe('BackOff', () => {
it('should return increasing timeouts', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import * as Bytes from '../../Bytes.js';
import * as Bytes from '../../Bytes.std.js';
describe('Bytes', () => {
it('converts to base64 and back', () => {

View File

@@ -6,7 +6,7 @@ import { Readable, Writable } from 'node:stream';
import { pipeline } from 'node:stream/promises';
import { BufferWriter } from 'protobufjs';
import { DelimitedStream } from '../../util/DelimitedStream.js';
import { DelimitedStream } from '../../util/DelimitedStream.node.js';
describe('DelimitedStream', () => {
function collect(out: Array<string>): Writable {

View File

@@ -3,7 +3,7 @@
import * as sinon from 'sinon';
import { LatestQueue } from '../../util/LatestQueue.js';
import { LatestQueue } from '../../util/LatestQueue.std.js';
describe('LatestQueue', () => {
it('if the queue is empty, new tasks are started immediately', done => {

View File

@@ -8,8 +8,8 @@ import {
appendMacStream,
MAC_KEY_SIZE,
MAC_SIZE,
} from '../../util/appendMacStream.js';
import { generateConfigMatrix } from '../../util/generateConfigMatrix.js';
} from '../../util/appendMacStream.node.js';
import { generateConfigMatrix } from '../../util/generateConfigMatrix.std.js';
describe('appendMacStream', () => {
generateConfigMatrix({

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { areObjectEntriesEqual } from '../../util/areObjectEntriesEqual.js';
import { areObjectEntriesEqual } from '../../util/areObjectEntriesEqual.std.js';
describe('areObjectEntriesEqual', () => {
type TestObject = { foo?: number; bar?: number };

View File

@@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { arePinnedConversationsEqual } from '../../util/arePinnedConversationsEqual.js';
import { SignalService as Proto } from '../../protobuf/index.js';
import { arePinnedConversationsEqual } from '../../util/arePinnedConversationsEqual.node.js';
import { SignalService as Proto } from '../../protobuf/index.std.js';
import PinnedConversation = Proto.AccountRecord.IPinnedConversation;

View File

@@ -3,7 +3,7 @@
import { assert as chaiAssert } from 'chai';
import { assertDev, strictAssert } from '../../util/assert.js';
import { assertDev, strictAssert } from '../../util/assert.std.js';
describe('assert utilities', () => {
describe('assert', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { assignWithNoUnnecessaryAllocation } from '../../util/assignWithNoUnnecessaryAllocation.js';
import { assignWithNoUnnecessaryAllocation } from '../../util/assignWithNoUnnecessaryAllocation.std.js';
describe('assignWithNoUnnecessaryAllocation', () => {
type Person = {

View File

@@ -3,8 +3,8 @@
import { assert } from 'chai';
import type { MaybeAsyncIterable } from '../../util/asyncIterables.js';
import { concat, wrapPromise } from '../../util/asyncIterables.js';
import type { MaybeAsyncIterable } from '../../util/asyncIterables.std.js';
import { concat, wrapPromise } from '../../util/asyncIterables.std.js';
describe('async iterable utilities', () => {
describe('concat', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { awaitObject } from '../../util/awaitObject.js';
import { awaitObject } from '../../util/awaitObject.std.js';
describe('awaitObject', () => {
it('returns correct result', async () => {

View File

@@ -4,8 +4,8 @@
import { assert } from 'chai';
import * as sinon from 'sinon';
import { createBatcher } from '../../util/batcher.js';
import { sleep } from '../../util/sleep.js';
import { createBatcher } from '../../util/batcher.std.js';
import { sleep } from '../../util/sleep.std.js';
describe('batcher', () => {
it('should schedule a full batch', async () => {

View File

@@ -3,15 +3,15 @@
import { assert } from 'chai';
import type { RecipientsByConversation } from '../../state/ducks/stories.js';
import type { ServiceIdString } from '../../types/ServiceId.js';
import type { RecipientsByConversation } from '../../state/ducks/stories.preload.js';
import type { ServiceIdString } from '../../types/ServiceId.std.js';
import { generateAci } from '../../types/ServiceId.js';
import { generateStoryDistributionId } from '../../types/StoryDistributionId.js';
import { generateAci } from '../../types/ServiceId.std.js';
import { generateStoryDistributionId } from '../../types/StoryDistributionId.std.js';
import {
getAllServiceIds,
filterServiceIds,
} from '../../util/blockSendUntilConversationsAreVerified.js';
} from '../../util/blockSendUntilConversationsAreVerified.dom.js';
describe('both/util/blockSendUntilConversationsAreVerified', () => {
const SERVICE_ID_1 = generateAci();

View File

@@ -8,12 +8,12 @@ import {
getPeerIdFromConversation,
getCallIdFromEra,
getGroupCallMeta,
} from '../../util/callDisposition.js';
} from '../../util/callDisposition.preload.js';
import {
getDefaultConversation,
getDefaultGroup,
} from '../../test-helpers/getDefaultConversation.js';
import { uuidToBytes } from '../../util/uuidToBytes.js';
} from '../../test-helpers/getDefaultConversation.std.js';
import { uuidToBytes } from '../../util/uuidToBytes.std.js';
const MOCK_ERA = 'abc';
const MOCK_CALL_ID = '16919744041952114874';

View File

@@ -6,13 +6,13 @@ import { assert } from 'chai';
import {
callLinkToRecord,
callLinkFromRecord,
} from '../../util/callLinksRingrtc.js';
} from '../../util/callLinksRingrtc.node.js';
import {
FAKE_CALL_LINK as CALL_LINK,
FAKE_CALL_LINK_WITH_ADMIN_KEY as CALL_LINK_WITH_ADMIN_KEY,
FAKE_CALL_LINK_WITH_EPOCH as CALL_LINK_WITH_EPOCH,
FAKE_CALL_LINK_WITH_ADMIN_KEY_AND_EPOCH as CALL_LINK_WITH_ADMIN_KEY_AND_EPOCH,
} from '../../test-helpers/fakeCallLink.js';
} from '../../test-helpers/fakeCallLink.std.js';
describe('callLinks', () => {
it('callLinkToRecord() and callLinkFromRecord() can convert to record and back', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { getParticipantName } from '../../util/callingGetParticipantName.js';
import { getParticipantName } from '../../util/callingGetParticipantName.std.js';
describe('getParticipantName', () => {
it('returns the first name if available', () => {

View File

@@ -10,9 +10,9 @@ import {
HangupType,
OpaqueMessage,
} from '@signalapp/ringrtc';
import { SignalService as Proto } from '../../protobuf/index.js';
import { SignalService as Proto } from '../../protobuf/index.std.js';
import { callingMessageToProto } from '../../util/callingMessageToProto.js';
import { callingMessageToProto } from '../../util/callingMessageToProto.node.js';
describe('callingMessageToProto', () => {
// NOTE: These tests are incomplete.

View File

@@ -2,20 +2,20 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { getCallingNotificationText } from '../../util/callingNotification.js';
import { getCallingNotificationText } from '../../util/callingNotification.std.js';
import {
CallMode,
CallDirection,
CallType,
GroupCallStatus,
} from '../../types/CallDisposition.js';
import i18n from './i18n.js';
} from '../../types/CallDisposition.std.js';
import i18n from './i18n.node.js';
import {
getDefaultConversation,
getDefaultGroup,
} from '../../test-helpers/getDefaultConversation.js';
import { getPeerIdFromConversation } from '../../util/callDisposition.js';
import { HOUR } from '../../util/durations/index.js';
} from '../../test-helpers/getDefaultConversation.std.js';
import { getPeerIdFromConversation } from '../../util/callDisposition.preload.js';
import { HOUR } from '../../util/durations/index.std.js';
describe('calling notification helpers', () => {
describe('getCallingNotificationText', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { count } from '../../util/characters.js';
import { count } from '../../util/characters.std.js';
describe('character utilities', () => {
describe('count', () => {

View File

@@ -3,7 +3,7 @@
import * as sinon from 'sinon';
import { clearTimeoutIfNecessary } from '../../util/clearTimeoutIfNecessary.js';
import { clearTimeoutIfNecessary } from '../../util/clearTimeoutIfNecessary.std.js';
describe('clearTimeoutIfNecessary', () => {
let sandbox: sinon.SinonSandbox;

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { combineNames } from '../../util/combineNames.js';
import { combineNames } from '../../util/combineNames.std.js';
describe('combineNames', () => {
it('returns undefined if no names provided', () => {

View File

@@ -3,11 +3,11 @@
import { assert } from 'chai';
import { v4 as generateUuid } from 'uuid';
import { countConversationUnreadStats } from '../../util/countUnreadStats.js';
import { countConversationUnreadStats } from '../../util/countUnreadStats.std.js';
import type {
UnreadStats,
ConversationPropsForUnreadStats,
} from '../../util/countUnreadStats.js';
} from '../../util/countUnreadStats.std.js';
function getFutureMutedTimestamp() {
return Date.now() + 12345;

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { createSupportUrl } from '../../util/createSupportUrl.js';
import { createSupportUrl } from '../../util/createSupportUrl.std.js';
describe('createSupportUrl', () => {
it('returns support url for "en" locale', () => {

View File

@@ -10,7 +10,7 @@ import {
toHumanDonationAmount,
toHumanCurrencyString,
toStripeDonationAmount,
} from '../../util/currency.js';
} from '../../util/currency.dom.js';
describe('parseCurrencyString', () => {
function testFn(

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { deconstructLookup } from '../../util/deconstructLookup.js';
import { deconstructLookup } from '../../util/deconstructLookup.std.js';
describe('deconstructLookup', () => {
it('looks up an array of properties in a lookup', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { diffArraysAsSets } from '../../util/diffArraysAsSets.js';
import { diffArraysAsSets } from '../../util/diffArraysAsSets.std.js';
function assertMatch<T>({
added,

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { dropNull, shallowDropNull } from '../../util/dropNull.js';
import { dropNull, shallowDropNull } from '../../util/dropNull.std.js';
type Test = {
a: number | null;

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { replaceEmojiWithSpaces, splitByEmoji } from '../../util/emoji.js';
import { replaceEmojiWithSpaces, splitByEmoji } from '../../util/emoji.std.js';
describe('emoji', () => {
describe('replaceEmojiWithSpaces', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { makeEnumParser } from '../../util/enum.js';
import { makeEnumParser } from '../../util/enum.std.js';
describe('enum utils', () => {
describe('makeEnumParser', () => {

View File

@@ -5,11 +5,11 @@ import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { assert } from 'chai';
import * as moment from 'moment';
import { setupI18n } from '../../util/setupI18n.js';
import { DurationInSeconds } from '../../util/durations/index.js';
import type { LocaleMessagesType } from '../../types/I18N.js';
import { setupI18n } from '../../util/setupI18n.dom.js';
import { DurationInSeconds } from '../../util/durations/index.std.js';
import type { LocaleMessagesType } from '../../types/I18N.std.js';
import * as expirationTimer from '../../util/expirationTimer.js';
import * as expirationTimer from '../../util/expirationTimer.std.js';
function loadMessages(locale: string): LocaleMessagesType {
const localePath = join(

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { explodePromise } from '../../util/explodePromise.js';
import { explodePromise } from '../../util/explodePromise.std.js';
describe('explodePromise', () => {
it('resolves the promise', async () => {

View File

@@ -2,12 +2,12 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import * as durations from '../../util/durations/index.js';
import * as durations from '../../util/durations/index.std.js';
import {
exponentialBackoffSleepTime,
exponentialBackoffMaxAttempts,
} from '../../util/exponentialBackoff.js';
} from '../../util/exponentialBackoff.std.js';
describe('exponential backoff utilities', () => {
describe('exponentialBackoffSleepTime', () => {

View File

@@ -3,9 +3,9 @@
import { assert } from 'chai';
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';
import { getDefaultConversation } from '../../test-helpers/getDefaultConversation.std.js';
import { filterAndSortConversations } from '../../util/filterAndSortConversations.std.js';
import type { ConversationType } from '../../state/ducks/conversations.preload.js';
const { pick } = lodash;

View File

@@ -5,7 +5,7 @@ import { assert } from 'chai';
import { Readable } from 'node:stream';
import { pipeline } from 'node:stream/promises';
import { finalStream } from '../../util/finalStream.js';
import { finalStream } from '../../util/finalStream.node.js';
describe('finalStream', () => {
it('should invoke callback before pipeline resolves', async () => {

View File

@@ -1,75 +0,0 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import * as sinon from 'sinon';
import { formatTimestamp } from '../../util/formatTimestamp.js';
import { HourCyclePreference } from '../../types/I18N.js';
const min = new Date(2023, 0, 1, 0).getTime();
const max = new Date(2023, 0, 1, 23).getTime();
describe('formatTimestamp', () => {
let sandbox: sinon.SinonSandbox;
let localesStub: sinon.SinonStub;
let localeOverrideStub: sinon.SinonStub;
let hourCycleStub: sinon.SinonStub;
beforeEach(() => {
sandbox = sinon.createSandbox();
localesStub = sandbox.stub(
window.SignalContext,
'getPreferredSystemLocales'
);
localeOverrideStub = sandbox.stub(
window.SignalContext,
'getLocaleOverride'
);
hourCycleStub = sandbox.stub(
window.SignalContext,
'getHourCyclePreference'
);
});
afterEach(() => {
sandbox.restore();
});
function testCase(
locale: string,
preference: HourCyclePreference,
time: number,
expected: string
) {
const timeFmt = new Intl.DateTimeFormat('en', {
timeStyle: 'medium',
}).format(time);
it(`should format with locale: ${locale} (${HourCyclePreference[preference]}) @ ${timeFmt})`, () => {
localesStub.returns([locale]);
localeOverrideStub.returns(null);
hourCycleStub.returns(preference);
assert.equal(formatTimestamp(time, { timeStyle: 'medium' }), expected);
});
}
testCase('en', HourCyclePreference.UnknownPreference, min, '12:00:00 AM');
testCase('en', HourCyclePreference.UnknownPreference, max, '11:00:00 PM');
testCase('en', HourCyclePreference.Prefer12, min, '12:00:00 AM');
testCase('en', HourCyclePreference.Prefer12, max, '11:00:00 PM');
testCase('en', HourCyclePreference.Prefer24, min, '00:00:00');
testCase('en', HourCyclePreference.Prefer24, max, '23:00:00');
testCase('nb', HourCyclePreference.UnknownPreference, min, '00:00:00');
testCase('nb', HourCyclePreference.UnknownPreference, max, '23:00:00');
testCase('nb', HourCyclePreference.Prefer12, min, '12:00:00 a.m.');
testCase('nb', HourCyclePreference.Prefer12, max, '11:00:00 p.m.');
testCase('nb', HourCyclePreference.Prefer24, min, '00:00:00');
testCase('nb', HourCyclePreference.Prefer24, max, '23:00:00');
testCase('ja', HourCyclePreference.UnknownPreference, min, '0:00:00');
testCase('ja', HourCyclePreference.UnknownPreference, max, '23:00:00');
testCase('ja', HourCyclePreference.Prefer12, min, '午前0:00:00');
testCase('ja', HourCyclePreference.Prefer12, max, '午後11:00:00');
testCase('ja', HourCyclePreference.Prefer24, min, '0:00:00');
testCase('ja', HourCyclePreference.Prefer24, max, '23:00:00');
});

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { generateConfigMatrix } from '../../util/generateConfigMatrix.js';
import { generateConfigMatrix } from '../../util/generateConfigMatrix.std.js';
describe('generateConfigMatrix', () => {
it('generates an empty list', () => {

View File

@@ -3,9 +3,9 @@
import { assert } from 'chai';
import { v4 as uuid } from 'uuid';
import { getRandomColor } from '../../test-helpers/getRandomColor.js';
import { getRandomColor } from '../../test-helpers/getRandomColor.std.js';
import { getAvatarData } from '../../util/getAvatarData.js';
import { getAvatarData } from '../../util/getAvatarData.dom.js';
describe('getAvatarData', () => {
it('returns existing avatars if present', () => {

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { getClassNamesFor } from '../../util/getClassNamesFor.js';
import { getClassNamesFor } from '../../util/getClassNamesFor.std.js';
describe('getClassNamesFor', () => {
it('returns a function', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { getCustomColorStyle } from '../../util/getCustomColorStyle.js';
import { getCustomColorStyle } from '../../util/getCustomColorStyle.dom.js';
describe('getCustomColorStyle', () => {
it('returns undefined if no color passed in', () => {

View File

@@ -6,8 +6,8 @@ import { assert } from 'chai';
import {
fontSniffer,
getFontNameByTextScript,
} from '../../util/getFontNameByTextScript.js';
import { setupI18n } from '../../util/setupI18n.js';
} from '../../util/getFontNameByTextScript.std.js';
import { setupI18n } from '../../util/setupI18n.dom.js';
describe('getFontNameByTextScript', () => {
it('has arabic', () => {

View File

@@ -2,13 +2,13 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import type { ConversationType } from '../../state/ducks/conversations.js';
import { generateAci } from '../../types/ServiceId.js';
import { normalizeAci } from '../../util/normalizeAci.js';
import type { ServiceIdString } from '../../types/ServiceId.js';
import { getDefaultConversationWithServiceId } from '../../test-helpers/getDefaultConversation.js';
import type { ConversationType } from '../../state/ducks/conversations.preload.js';
import { generateAci } from '../../types/ServiceId.std.js';
import { normalizeAci } from '../../util/normalizeAci.std.js';
import type { ServiceIdString } from '../../types/ServiceId.std.js';
import { getDefaultConversationWithServiceId } from '../../test-helpers/getDefaultConversation.std.js';
import { getGroupMemberships } from '../../util/getGroupMemberships.js';
import { getGroupMemberships } from '../../util/getGroupMemberships.dom.js';
describe('getGroupMemberships', () => {
const normalConversation1 = getDefaultConversationWithServiceId();

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { getHSL } from '../../util/getHSL.js';
import { getHSL } from '../../util/getHSL.std.js';
describe('getHSL', () => {
it('returns expected lightness values', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { getInitials } from '../../util/getInitials.js';
import { getInitials } from '../../util/getInitials.std.js';
describe('getInitials', () => {
it('returns undefined when passed undefined', () => {

View File

@@ -3,9 +3,9 @@
import { assert } from 'chai';
import * as sinon from 'sinon';
import i18n from './i18n.js';
import i18n from './i18n.node.js';
import { getMuteOptions } from '../../util/getMuteOptions.js';
import { getMuteOptions } from '../../util/getMuteOptions.std.js';
describe('getMuteOptions', () => {
const HOUR = 3600000;

View File

@@ -3,9 +3,9 @@
import { assert } from 'chai';
import * as sinon from 'sinon';
import i18n from './i18n.js';
import i18n from './i18n.node.js';
import { getMutedUntilText } from '../../util/getMutedUntilText.js';
import { getMutedUntilText } from '../../util/getMutedUntilText.std.js';
describe('getMutedUntilText', () => {
let sandbox: sinon.SinonSandbox;

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { getOwn } from '../../util/getOwn.js';
import { getOwn } from '../../util/getOwn.std.js';
describe('getOwn', () => {
class Person {

View File

@@ -7,7 +7,7 @@ import * as sinon from 'sinon';
import lodash from 'lodash';
import { once } from 'node:events';
import { getStreamWithTimeout } from '../../util/getStreamWithTimeout.js';
import { getStreamWithTimeout } from '../../util/getStreamWithTimeout.node.js';
const { noop } = lodash;

View File

@@ -4,7 +4,7 @@
import { assert } from 'chai';
import * as sinon from 'sinon';
import { getUserAgent } from '../../util/getUserAgent.js';
import { getUserAgent } from '../../util/getUserAgent.node.js';
describe('getUserAgent', () => {
beforeEach(function (this: Mocha.Context) {

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { graphemeAndLinkAwareSlice } from '../../util/graphemeAndLinkAwareSlice.js';
import { graphemeAndLinkAwareSlice } from '../../util/graphemeAndLinkAwareSlice.std.js';
describe('graphemeAndLinkAwareSlice', () => {
it('returns entire string when shorter than maximum', () => {

View File

@@ -8,7 +8,7 @@ import {
count,
hasAtMostGraphemes,
isSingleGrapheme,
} from '../../util/grapheme.js';
} from '../../util/grapheme.std.js';
describe('grapheme utilities', () => {
describe('getGraphemes', () => {

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { groupWhile, formatGroups } from '../../util/groupWhile.js';
import { groupWhile, formatGroups } from '../../util/groupWhile.std.js';
describe('groupWhile/formatGroups', () => {
function check(

View File

@@ -2,14 +2,14 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { getDefaultConversation } from '../../test-helpers/getDefaultConversation.js';
import { getDefaultConversation } from '../../test-helpers/getDefaultConversation.std.js';
import {
dehydrateCollisionsWithConversations,
getCollisionsFromMemberships,
hasUnacknowledgedCollisions,
invertIdsByTitle,
} from '../../util/groupMemberNameCollisions.js';
} from '../../util/groupMemberNameCollisions.std.js';
describe('group member name collision utilities', () => {
describe('dehydrateCollisionsWithConversations', () => {

View File

@@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import assert from 'node:assert/strict';
import { validateGroupSendEndorsementsExpiration } from '../../util/groupSendEndorsements.js';
import { DAY, HOUR, SECOND } from '../../util/durations/index.js';
import { validateGroupSendEndorsementsExpiration } from '../../util/groupSendEndorsements.preload.js';
import { DAY, HOUR, SECOND } from '../../util/durations/index.std.js';
describe('groupSendEndorsements', () => {
describe('validateGroupSendEndorsementsExpiration', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { hslToRGB, hslToRGBInt } from '../../util/hslToRGB.js';
import { hslToRGB, hslToRGBInt } from '../../util/hslToRGB.std.js';
describe('hslToRGB', () => {
it('converts pure rgb colors', () => {

View File

@@ -4,7 +4,8 @@
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { setupI18n } from '../../util/setupI18n.js';
import { setupI18n } from '../../util/setupI18nMain.std.js';
import { shouldNeverBeCalled } from '../../util/shouldNeverBeCalled.std.js';
const PATH = join(
__dirname,
@@ -18,4 +19,8 @@ const PATH = join(
export const enMessages = JSON.parse(readFileSync(PATH, 'utf8'));
export default setupI18n('en', enMessages);
export default setupI18n('en', enMessages, {
renderEmojify: shouldNeverBeCalled,
getLocaleDirection: shouldNeverBeCalled,
getHourCyclePreference: shouldNeverBeCalled,
});

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isConversationMuted } from '../../util/isConversationMuted.js';
import { isConversationMuted } from '../../util/isConversationMuted.std.js';
describe('isConversationMuted', () => {
it('returns false if passed an undefined expiry time', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isConversationNameKnown } from '../../util/isConversationNameKnown.js';
import { isConversationNameKnown } from '../../util/isConversationNameKnown.std.js';
describe('isConversationNameKnown', () => {
describe('for direct conversations', () => {

View File

@@ -2,9 +2,9 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { generateAci } from '../../types/ServiceId.js';
import { generateAci } from '../../types/ServiceId.std.js';
import { isConversationSMSOnly } from '../../util/isConversationSMSOnly.js';
import { isConversationSMSOnly } from '../../util/isConversationSMSOnly.std.js';
const serviceId = generateAci();

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isConversationUnread } from '../../util/isConversationUnread.js';
import { isConversationUnread } from '../../util/isConversationUnread.std.js';
describe('isConversationUnread', () => {
it('returns false if both markedUnread and unreadCount are undefined', () => {

View File

@@ -2,10 +2,10 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { generateAci } from '../../types/ServiceId.js';
import * as durations from '../../util/durations/index.js';
import { generateAci } from '../../types/ServiceId.std.js';
import * as durations from '../../util/durations/index.std.js';
import { isConversationUnregistered } from '../../util/isConversationUnregistered.js';
import { isConversationUnregistered } from '../../util/isConversationUnregistered.dom.js';
const serviceId = generateAci();

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isFileDangerous } from '../../util/isFileDangerous.js';
import { isFileDangerous } from '../../util/isFileDangerous.std.js';
describe('isFileDangerous', () => {
it('returns false for images', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isInSystemContacts } from '../../util/isInSystemContacts.js';
import { isInSystemContacts } from '../../util/isInSystemContacts.std.js';
describe('isInSystemContacts', () => {
it('returns true for direct conversations that have a `name` property', () => {

View File

@@ -2,9 +2,9 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { ReadStatus } from '../../messages/MessageReadStatus.js';
import { ReadStatus } from '../../messages/MessageReadStatus.std.js';
import { isMessageUnread } from '../../util/isMessageUnread.js';
import { isMessageUnread } from '../../util/isMessageUnread.std.js';
describe('isMessageUnread', () => {
it("returns false if the message's `readStatus` field is undefined", () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isNormalNumber } from '../../util/isNormalNumber.js';
import { isNormalNumber } from '../../util/isNormalNumber.std.js';
describe('isNormalNumber', () => {
it('returns false for non-numbers', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isNotNil } from '../../util/isNotNil.js';
import { isNotNil } from '../../util/isNotNil.std.js';
describe('isNotNil', () => {
it('returns false if provided null value', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isPathInside } from '../../util/isPathInside.js';
import { isPathInside } from '../../util/isPathInside.node.js';
describe('isPathInside', () => {
it('returns false if the child path is not inside the parent path', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isRecord } from '../../util/isRecord.js';
import { isRecord } from '../../util/isRecord.std.js';
describe('isRecord', () => {
it('returns false for primitives', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isSorted } from '../../util/isSorted.js';
import { isSorted } from '../../util/isSorted.std.js';
describe('isSorted', () => {
it('returns true for empty lists', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isValidE164 } from '../../util/isValidE164.js';
import { isValidE164 } from '../../util/isValidE164.std.js';
describe('isValidE164', () => {
it('returns false for non-strings', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { isValidUuid } from '../../util/isValidUuid.js';
import { isValidUuid } from '../../util/isValidUuid.std.js';
describe('isValidUuid', () => {
const LOWERCASE_V4_UUID = '9cb737ce-2bb3-4c21-9fe0-d286caa0ca68';

View File

@@ -20,7 +20,7 @@ import {
size,
take,
zipObject,
} from '../../util/iterables.js';
} from '../../util/iterables.std.js';
describe('iterable utilities', () => {
describe('isIterable', () => {

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert, AssertionError } from 'chai';
import { parseNumber } from '../../util/libphonenumberUtil.js';
import { parseNumber } from '../../util/libphonenumberUtil.std.js';
describe('libphonenumber util', () => {
describe('parseNumber', () => {

View File

@@ -4,8 +4,8 @@
import { assert } from 'chai';
import { Readable } from 'node:stream';
import { appendPaddingStream } from '../../util/logPadding.js';
import { logPadSize } from '../../util/logPadSize.js';
import { appendPaddingStream } from '../../util/logPadding.node.js';
import { logPadSize } from '../../util/logPadSize.std.js';
const BUCKET_SIZES = [
541, 568, 596, 626, 657, 690, 725, 761, 799, 839, 881, 925, 972, 1020, 1071,

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { makeLookup } from '../../util/makeLookup.js';
import { makeLookup } from '../../util/makeLookup.std.js';
describe('makeLookup', () => {
it('returns an empty object if passed an empty array', () => {

View File

@@ -3,8 +3,8 @@
import * as sinon from 'sinon';
import assert from 'node:assert/strict';
import type { MapEmplaceOptions } from '../../util/mapEmplace.js';
import { mapEmplace } from '../../util/mapEmplace.js';
import type { MapEmplaceOptions } from '../../util/mapEmplace.std.js';
import { mapEmplace } from '../../util/mapEmplace.std.js';
type InsertFn = NonNullable<MapEmplaceOptions<Map<object, object>>['insert']>;
type UpdateFn = NonNullable<MapEmplaceOptions<Map<object, object>>['update']>;

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { mapObjectWithSpec } from '../../util/mapObjectWithSpec.js';
import { mapObjectWithSpec } from '../../util/mapObjectWithSpec.std.js';
describe('mapObjectWithSpec', () => {
const increment = (value: number) => value + 1;

View File

@@ -4,7 +4,7 @@
import { assert } from 'chai';
import * as sinon from 'sinon';
import { groupBy, isEqual } from '../../util/mapUtil.js';
import { groupBy, isEqual } from '../../util/mapUtil.std.js';
describe('map utilities', () => {
describe('groupBy', () => {

View File

@@ -3,27 +3,25 @@
import lodash from 'lodash';
import type { CustomError } from '../../textsecure/Types.js';
import type { CustomError } from '../../textsecure/Types.d.ts';
import type { MessageAttributesType } from '../../model-types.js';
import { createLogger } from '../../logging/log.js';
import * as Errors from '../../types/errors.js';
import type { MessageAttributesType } from '../../model-types.d.ts';
import { createLogger } from '../../logging/log.std.js';
import * as Errors from '../../types/errors.std.js';
import { NotificationType } from '../../types/notifications.std.js';
import {
getChangesForPropAtTimestamp,
getPropForTimestamp,
} from '../../util/editHelpers.js';
} from '../../util/editHelpers.std.js';
import {
isSent,
SendActionType,
sendStateReducer,
someRecipientSendStatus,
} from '../../messages/MessageSendState.js';
import { isStory } from '../../messages/helpers.js';
import {
notificationService,
NotificationType,
} from '../../services/notifications.js';
import type { MessageModel } from '../../models/messages.js';
} from '../../messages/MessageSendState.std.js';
import { isStory } from '../../messages/helpers.std.js';
import { notificationService } from '../../services/notifications.preload.js';
import type { MessageModel } from '../../models/messages.preload.js';
const { mapValues, pick } = lodash;

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { normalizeDeviceName } from '../../util/normalizeDeviceName.js';
import { normalizeDeviceName } from '../../util/normalizeDeviceName.std.js';
describe('normalizeDeviceName', () => {
it('leaves normal device names untouched', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { parseIntOrThrow } from '../../util/parseIntOrThrow.js';
import { parseIntOrThrow } from '../../util/parseIntOrThrow.std.js';
describe('parseIntOrThrow', () => {
describe('when passed a number argument', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { parseIntWithFallback } from '../../util/parseIntWithFallback.js';
import { parseIntWithFallback } from '../../util/parseIntWithFallback.std.js';
describe('parseIntWithFallback', () => {
describe('when passed a number argument', () => {

View File

@@ -2,9 +2,9 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { MINUTE } from '../../util/durations/index.js';
import { MINUTE } from '../../util/durations/index.std.js';
import { parseRetryAfterWithDefault } from '../../util/parseRetryAfter.js';
import { parseRetryAfterWithDefault } from '../../util/parseRetryAfter.std.js';
describe('parseRetryAfter', () => {
it('should return 1 minute when passed non-strings', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { prependStream } from '../../util/prependStream.js';
import { prependStream } from '../../util/prependStream.node.js';
describe('prependStream', () => {
it('should prepend stream with a prefix', async () => {

View File

@@ -3,8 +3,8 @@
import { assert } from 'chai';
import * as Privacy from '../../util/privacy.js';
import { APP_ROOT_PATH } from '../../util/privacy.js';
import * as Privacy from '../../util/privacy.node.js';
import { APP_ROOT_PATH } from '../../util/privacy.node.js';
Privacy.addSensitivePath('sensitive-path');

View File

@@ -3,12 +3,12 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { assert } from 'chai';
import type { MessageAttributesType } from '../../model-types.js';
import type { AttachmentType } from '../../types/Attachment.js';
import { IMAGE_JPEG, LONG_MESSAGE } from '../../types/MIME.js';
import { generateMessageId } from '../../util/generateMessageId.js';
import { ensureBodyAttachmentsAreSeparated } from '../../util/queueAttachmentDownloads.js';
import { createLogger } from '../../logging/log.js';
import type { MessageAttributesType } from '../../model-types.d.ts';
import type { AttachmentType } from '../../types/Attachment.std.js';
import { IMAGE_JPEG, LONG_MESSAGE } from '../../types/MIME.std.js';
import { generateMessageId } from '../../util/generateMessageId.node.js';
import { ensureBodyAttachmentsAreSeparated } from '../../util/queueAttachmentDownloads.preload.js';
import { createLogger } from '../../logging/log.std.js';
const logger = createLogger('queueAttachmentDownloads_test');

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { reallyJsonStringify } from '../../util/reallyJsonStringify.js';
import { reallyJsonStringify } from '../../util/reallyJsonStringify.std.js';
describe('reallyJsonStringify', () => {
it('returns the same thing as JSON.stringify when JSON.stringify returns a string', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { replaceIndex } from '../../util/replaceIndex.js';
import { replaceIndex } from '../../util/replaceIndex.std.js';
describe('replaceIndex', () => {
it('returns a new array with an index replaced', () => {

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import assert from 'node:assert/strict';
import { resolveCanonicalLocales } from '../../util/resolveCanonicalLocales.js';
import { resolveCanonicalLocales } from '../../util/resolveCanonicalLocales.std.js';
describe('resolveCanonicalLocales', () => {
it('returns an array of canonical locales', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { rgbIntToHSL, rgbToHSL } from '../../util/rgbToHSL.js';
import { rgbIntToHSL, rgbToHSL } from '../../util/rgbToHSL.std.js';
describe('rgbToHSL', () => {
it('converts pure rgb colors', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { nonRenderedRemoteParticipant } from '../../../util/ringrtc/nonRenderedRemoteParticipant.js';
import { nonRenderedRemoteParticipant } from '../../../util/ringrtc/nonRenderedRemoteParticipant.std.js';
describe('nonRenderedRemoteParticipant', () => {
it('returns a video request object a width and height of 0', () => {

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { normalizeGroupCallTimestamp } from '../../../util/ringrtc/normalizeGroupCallTimestamp.js';
import { normalizeGroupCallTimestamp } from '../../../util/ringrtc/normalizeGroupCallTimestamp.std.js';
describe('normalizeGroupCallTimestamp', () => {
it('returns undefined if passed a string that cannot be parsed as a number', () => {

View File

@@ -9,7 +9,7 @@ import {
parseStrict,
parseUnknown,
SchemaParseError,
} from '../../util/schemas.js';
} from '../../util/schemas.std.js';
describe('schemas', () => {
const schema = z.object({ prop: z.literal('value') });

View File

@@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { getDefaultConversation } from '../../test-helpers/getDefaultConversation.js';
import { searchConversationTitles } from '../../util/searchConversationTitles.js';
import { getDefaultConversation } from '../../test-helpers/getDefaultConversation.std.js';
import { searchConversationTitles } from '../../util/searchConversationTitles.std.js';
describe('searchContactTitles', () => {
const conversations = [

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { generateSnippetAroundMention } from '../../util/search.js';
import { generateSnippetAroundMention } from '../../util/search.std.js';
describe('generateSnippetAroundMention', () => {
it('generates snippet around mention at start of body', () => {

View File

@@ -2,9 +2,9 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { getServerAlertToShow } from '../../util/handleServerAlerts.js';
import { ServerAlert } from '../../types/ServerAlert.js';
import { DAY, MONTH, WEEK } from '../../util/durations/index.js';
import { getServerAlertToShow } from '../../util/handleServerAlerts.preload.js';
import { ServerAlert } from '../../types/ServerAlert.std.js';
import { DAY, MONTH, WEEK } from '../../util/durations/index.std.js';
describe('serverAlerts', () => {
it('should prefer critical alerts', () => {

View File

@@ -6,9 +6,9 @@
import { assert } from 'chai';
import Long from 'long';
import * as Bytes from '../../Bytes.js';
import type { LocalUserDataType } from '../../util/sessionTranslation.js';
import { sessionRecordToProtobuf } from '../../util/sessionTranslation.js';
import * as Bytes from '../../Bytes.std.js';
import type { LocalUserDataType } from '../../util/sessionTranslation.node.js';
import { sessionRecordToProtobuf } from '../../util/sessionTranslation.node.js';
const getRecordCopy = (record: any): any => JSON.parse(JSON.stringify(record));

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { difference, isEqual, remove, toggle } from '../../util/setUtil.js';
import { difference, isEqual, remove, toggle } from '../../util/setUtil.std.js';
describe('set utilities', () => {
const original = new Set([1, 2, 3]);

View File

@@ -1,14 +1,14 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import type { ParsedSignalRoute } from '../../util/signalRoutes.js';
import type { ParsedSignalRoute } from '../../util/signalRoutes.std.js';
import {
isSignalRoute,
parseSignalRoute,
toSignalRouteAppUrl,
toSignalRouteUrl,
toSignalRouteWebUrl,
} from '../../util/signalRoutes.js';
} from '../../util/signalRoutes.std.js';
describe('signalRoutes', () => {
type CheckConfig = {

View File

@@ -4,7 +4,7 @@
import { assert } from 'chai';
import { useFakeTimers } from 'sinon';
import { sleep } from '../../util/sleep.js';
import { sleep } from '../../util/sleep.std.js';
describe('sleep', () => {
beforeEach(function (this: Mocha.Context) {

Some files were not shown because too many files have changed in this diff Show More