Upgrade Prettier to 2.4.1

This commit is contained in:
Evan Hahn 2021-11-11 16:43:05 -06:00 committed by GitHub
parent f204784afe
commit 5619eeca83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
176 changed files with 1961 additions and 2465 deletions

View file

@ -438,22 +438,8 @@ describe('Crypto', () => {
describe('uuidToBytes', () => {
it('converts valid UUIDs to Uint8Arrays', () => {
const expectedResult = new Uint8Array([
0x22,
0x6e,
0x44,
0x02,
0x7f,
0xfc,
0x45,
0x43,
0x85,
0xc9,
0x46,
0x22,
0xc5,
0x0a,
0x5b,
0x14,
0x22, 0x6e, 0x44, 0x02, 0x7f, 0xfc, 0x45, 0x43, 0x85, 0xc9, 0x46, 0x22,
0xc5, 0x0a, 0x5b, 0x14,
]);
assert.deepEqual(
@ -483,22 +469,8 @@ describe('Crypto', () => {
describe('bytesToUuid', () => {
it('converts valid Uint8Arrays to UUID strings', () => {
const buf = new Uint8Array([
0x22,
0x6e,
0x44,
0x02,
0x7f,
0xfc,
0x45,
0x43,
0x85,
0xc9,
0x46,
0x22,
0xc5,
0x0a,
0x5b,
0x14,
0x22, 0x6e, 0x44, 0x02, 0x7f, 0xfc, 0x45, 0x43, 0x85, 0xc9, 0x46, 0x22,
0xc5, 0x0a, 0x5b, 0x14,
]);
assert.deepEqual(

View file

@ -127,28 +127,23 @@ describe('link preview fetching', () => {
it('handles image href sources in the correct order', async () => {
const orderedImageHrefSources = [
{
tag:
'<meta property="og:image" content="https://example.com/og-image.jpg">',
tag: '<meta property="og:image" content="https://example.com/og-image.jpg">',
expectedHref: 'https://example.com/og-image.jpg',
},
{
tag:
'<meta property="og:image:url" content="https://example.com/og-image-url.jpg">',
tag: '<meta property="og:image:url" content="https://example.com/og-image-url.jpg">',
expectedHref: 'https://example.com/og-image-url.jpg',
},
{
tag:
'<link rel="apple-touch-icon" href="https://example.com/apple-touch-icon.jpg">',
tag: '<link rel="apple-touch-icon" href="https://example.com/apple-touch-icon.jpg">',
expectedHref: 'https://example.com/apple-touch-icon.jpg',
},
{
tag:
'<link rel="apple-touch-icon-precomposed" href="https://example.com/apple-touch-icon-precomposed.jpg">',
tag: '<link rel="apple-touch-icon-precomposed" href="https://example.com/apple-touch-icon-precomposed.jpg">',
expectedHref: 'https://example.com/apple-touch-icon-precomposed.jpg',
},
{
tag:
'<link rel="shortcut icon" href="https://example.com/shortcut-icon.jpg">',
tag: '<link rel="shortcut icon" href="https://example.com/shortcut-icon.jpg">',
expectedHref: 'https://example.com/shortcut-icon.jpg',
},
{

View file

@ -103,15 +103,18 @@ describe('Message', () => {
it('updates `sendStateByConversationId`', async function test() {
this.sandbox.useFakeTimers(1234);
const ourConversationId = window.ConversationController.getOurConversationIdOrThrow();
const conversation1 = await window.ConversationController.getOrCreateAndWait(
'a072df1d-7cee-43e2-9e6b-109710a2131c',
'private'
);
const conversation2 = await window.ConversationController.getOrCreateAndWait(
'62bd8ef1-68da-4cfd-ac1f-3ea85db7473e',
'private'
);
const ourConversationId =
window.ConversationController.getOurConversationIdOrThrow();
const conversation1 =
await window.ConversationController.getOrCreateAndWait(
'a072df1d-7cee-43e2-9e6b-109710a2131c',
'private'
);
const conversation2 =
await window.ConversationController.getOrCreateAndWait(
'62bd8ef1-68da-4cfd-ac1f-3ea85db7473e',
'private'
);
const message = createMessage({
type: 'outgoing',
@ -395,8 +398,7 @@ describe('Message', () => {
group_update: { joined: ['Bob', 'Alice', 'Eve'] },
}).getNotificationData(),
{
text:
'+1 415-555-5555 updated the group. Bob, Alice, Eve joined the group.',
text: '+1 415-555-5555 updated the group. Bob, Alice, Eve joined the group.',
}
);
});
@ -409,8 +411,7 @@ describe('Message', () => {
group_update: { joined: ['Bob', me, 'Alice', 'Eve'] },
}).getNotificationData(),
{
text:
'+1 415-555-5555 updated the group. Bob, Alice, Eve joined the group. You joined the group.',
text: '+1 415-555-5555 updated the group. Bob, Alice, Eve joined the group. You joined the group.',
}
);
});
@ -423,8 +424,7 @@ describe('Message', () => {
group_update: { joined: ['Bob'], name: 'blerg' },
}).getNotificationData(),
{
text:
"+1 415-555-5555 updated the group. Bob joined the group. Group name is now 'blerg'.",
text: "+1 415-555-5555 updated the group. Bob joined the group. Group name is now 'blerg'.",
}
);
});

View file

@ -43,10 +43,8 @@ describe('emojiCompletion', () => {
text: ':smile:',
};
mockQuill.getLeaf.returns([blot, 2]);
const [
leftLeafText,
rightLeafText,
] = emojiCompletion.getCurrentLeafTextPartitions();
const [leftLeafText, rightLeafText] =
emojiCompletion.getCurrentLeafTextPartitions();
assert.equal(leftLeafText, ':s');
assert.equal(rightLeafText, 'mile:');
});

View file

@ -82,7 +82,7 @@ describe('MentionCompletion', () => {
};
mentionCompletion = new MentionCompletion(
(mockQuill as unknown) as Quill,
mockQuill as unknown as Quill,
options
);

View file

@ -44,12 +44,10 @@ describe('SenderCertificateService', () => {
fakeValidCertificateExpiry = Date.now() + 604800000;
const certificate = new SenderCertificate.Certificate();
certificate.expires = Long.fromNumber(fakeValidCertificateExpiry);
fakeValidCertificate.certificate = SenderCertificate.Certificate.encode(
certificate
).finish();
fakeValidEncodedCertificate = SenderCertificate.encode(
fakeValidCertificate
).finish();
fakeValidCertificate.certificate =
SenderCertificate.Certificate.encode(certificate).finish();
fakeValidEncodedCertificate =
SenderCertificate.encode(fakeValidCertificate).finish();
fakeServer = {
getSenderCertificate: sinon.stub().resolves({
@ -207,9 +205,8 @@ describe('SenderCertificateService', () => {
const expiredCertificate = new SenderCertificate();
const certificate = new SenderCertificate.Certificate();
certificate.expires = Long.fromNumber(Date.now() - 1000);
expiredCertificate.certificate = SenderCertificate.Certificate.encode(
certificate
).finish();
expiredCertificate.certificate =
SenderCertificate.Certificate.encode(certificate).finish();
fakeServer.getSenderCertificate.resolves({
certificate: Bytes.toBase64(
SenderCertificate.encode(expiredCertificate).finish()

View file

@ -51,9 +51,12 @@ describe('AccountManager', () => {
});
afterEach(() => {
window.textsecure.storage.user.getUuid = originalGetUuid;
window.textsecure.storage.protocol.getIdentityKeyPair = originalGetIdentityKeyPair;
window.textsecure.storage.protocol.loadSignedPreKeys = originalLoadSignedPreKeys;
window.textsecure.storage.protocol.removeSignedPreKey = originalRemoveSignedPreKey;
window.textsecure.storage.protocol.getIdentityKeyPair =
originalGetIdentityKeyPair;
window.textsecure.storage.protocol.loadSignedPreKeys =
originalLoadSignedPreKeys;
window.textsecure.storage.protocol.removeSignedPreKey =
originalRemoveSignedPreKey;
});
describe('encrypted device name', () => {

View file

@ -92,10 +92,10 @@ describe('Attachments', () => {
it('throws if passed a non-string', () => {
assert.throws(() => {
Attachments.copyIntoAttachmentsDirectory((1234 as unknown) as string);
Attachments.copyIntoAttachmentsDirectory(1234 as unknown as string);
}, TypeError);
assert.throws(() => {
Attachments.copyIntoAttachmentsDirectory((null as unknown) as string);
Attachments.copyIntoAttachmentsDirectory(null as unknown as string);
}, TypeError);
});
@ -103,7 +103,7 @@ describe('Attachments', () => {
const copier = Attachments.copyIntoAttachmentsDirectory(
await getFakeAttachmentsDirectory()
);
await assert.isRejected(copier((123 as unknown) as string));
await assert.isRejected(copier(123 as unknown as string));
});
it('returns a function that rejects if the source path is not in the user config directory', async () => {