Skip to content

Commit f179652

Browse files
feat(mbe): fix linting
1 parent 1019f3b commit f179652

File tree

4 files changed

+70
-86
lines changed

4 files changed

+70
-86
lines changed

src/__tests__/api/master/accelerate.test.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,11 @@ describe('POST /api/:coin/wallet/:walletId/accelerate', () => {
307307
});
308308

309309
it('should fail when authorization header is missing', async () => {
310-
const response = await agent
311-
.post(`/api/${coin}/wallet/${walletId}/accelerate`)
312-
.send({
313-
pubkey: mockUserKeychain.pub,
314-
source: 'user',
315-
cpfpTxIds: ['test-tx-id'],
316-
});
310+
const response = await agent.post(`/api/${coin}/wallet/${walletId}/accelerate`).send({
311+
pubkey: mockUserKeychain.pub,
312+
source: 'user',
313+
cpfpTxIds: ['test-tx-id'],
314+
});
317315

318316
response.status.should.equal(500);
319317
response.body.should.have.property('error', 'Internal Server Error');
@@ -410,4 +408,4 @@ describe('POST /api/:coin/wallet/:walletId/accelerate', () => {
410408
response.body.should.have.property('error', 'Internal Server Error');
411409
response.body.should.have.property('details');
412410
});
413-
});
411+
});

src/__tests__/api/master/consolidate.test.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,10 @@ describe('POST /api/:coin/wallet/:walletId/consolidate', () => {
382382

383383
response.status.should.equal(500);
384384
response.body.should.have.property('error', 'Internal Server Error');
385-
response.body.should.have.property('details', 'Invalid coin selected - account consolidations not supported');
385+
response.body.should.have.property(
386+
'details',
387+
'Invalid coin selected - account consolidations not supported',
388+
);
386389

387390
walletGetNock.done();
388391
keychainGetNock.done();
@@ -433,13 +436,11 @@ describe('POST /api/:coin/wallet/:walletId/consolidate', () => {
433436
});
434437

435438
it('should fail when authorization header is missing', async () => {
436-
const response = await agent
437-
.post(`/api/${coin}/wallet/${walletId}/consolidate`)
438-
.send({
439-
pubkey: mockUserKeychain.pub,
440-
source: 'user',
441-
consolidateAddresses: ['0x1234567890abcdef'],
442-
});
439+
const response = await agent.post(`/api/${coin}/wallet/${walletId}/consolidate`).send({
440+
pubkey: mockUserKeychain.pub,
441+
source: 'user',
442+
consolidateAddresses: ['0x1234567890abcdef'],
443+
});
443444

444445
response.status.should.equal(500);
445446
response.body.should.have.property('error', 'Internal Server Error');
@@ -492,7 +493,9 @@ describe('POST /api/:coin/wallet/:walletId/consolidate', () => {
492493

493494
response.status.should.equal(500);
494495
response.body.should.have.property('error', 'Internal Server Error');
495-
response.body.should.have.property('details').which.match(/Consolidations failed: 1 and succeeded: 1/);
496+
response.body.should.have
497+
.property('details')
498+
.which.match(/Consolidations failed: 1 and succeeded: 1/);
496499

497500
walletGetNock.done();
498501
keychainGetNock.done();

src/__tests__/api/master/consolidateUnspents.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,11 @@ describe('POST /api/:coin/wallet/:walletId/consolidateunspents', () => {
341341
});
342342

343343
it('should fail when authorization header is missing', async () => {
344-
const response = await agent
345-
.post(`/api/${coin}/wallet/${walletId}/consolidateunspents`)
346-
.send({
347-
pubkey: mockUserKeychain.pub,
348-
source: 'user',
349-
feeRate: 1000,
350-
});
344+
const response = await agent.post(`/api/${coin}/wallet/${walletId}/consolidateunspents`).send({
345+
pubkey: mockUserKeychain.pub,
346+
source: 'user',
347+
feeRate: 1000,
348+
});
351349

352350
response.status.should.equal(500);
353351
response.body.should.have.property('error', 'Internal Server Error');

src/__tests__/api/master/recoveryConsolidationsWallet.test.ts

Lines changed: 47 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
1414
const enclavedExpressUrl = 'https://test-enclaved-express.com';
1515
const accessToken = 'test-access-token';
1616

17-
const mockUserPub = 'xpub661MyMwAqRbcFkPHucMnrGNzDwb6teAX1RbKQmqtEF8kK3Z7LZ59qafCjB9eCWzSgHCZkdXgp';
18-
const mockBackupPub = 'xpub661MyMwAqRbcGaZrYqfYmaTRzQxM9PKEZ7GRb6DKfghkzgjk2dKT4qBXfz6WzpT4N5fXJhFW';
19-
const mockBitgoPub = 'xpub661MyMwAqRbcF1cvdJUvQ8MV6a7R5hF5cBmVxA1zS1k7RH7NKj3X7K8fgR4kS2qY6jW9cF7L';
17+
const mockUserPub =
18+
'xpub661MyMwAqRbcFkPHucMnrGNzDwb6teAX1RbKQmqtEF8kK3Z7LZ59qafCjB9eCWzSgHCZkdXgp';
19+
const mockBackupPub =
20+
'xpub661MyMwAqRbcGaZrYqfYmaTRzQxM9PKEZ7GRb6DKfghkzgjk2dKT4qBXfz6WzpT4N5fXJhFW';
21+
const mockBitgoPub =
22+
'xpub661MyMwAqRbcF1cvdJUvQ8MV6a7R5hF5cBmVxA1zS1k7RH7NKj3X7K8fgR4kS2qY6jW9cF7L';
2023
const mockCommonKeychain = 'common-keychain-123';
2124

2225
before(() => {
@@ -52,11 +55,9 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
5255
{ txHex: 'unsigned-tx-2', serializedTx: 'serialized-unsigned-tx-2' },
5356
];
5457

55-
const recoverConsolidationsStub = sinon
56-
.stub(Trx.prototype, 'recoverConsolidations')
57-
.resolves({
58-
transactions: mockTransactions,
59-
});
58+
const recoverConsolidationsStub = sinon.stub(Trx.prototype, 'recoverConsolidations').resolves({
59+
transactions: mockTransactions,
60+
});
6061

6162
const recoveryMultisigStub = sinon
6263
.stub(EnclavedExpressClient.prototype, 'recoveryMultisig')
@@ -92,15 +93,11 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
9293
});
9394

9495
it('should succeed in handling Solana consolidation recovery for onchain wallet', async () => {
95-
const mockTransactions = [
96-
{ txHex: 'unsigned-tx-1', serializedTx: 'serialized-unsigned-tx-1' },
97-
];
96+
const mockTransactions = [{ txHex: 'unsigned-tx-1', serializedTx: 'serialized-unsigned-tx-1' }];
9897

99-
const recoverConsolidationsStub = sinon
100-
.stub(Sol.prototype, 'recoverConsolidations')
101-
.resolves({
102-
transactions: mockTransactions,
103-
});
98+
const recoverConsolidationsStub = sinon.stub(Sol.prototype, 'recoverConsolidations').resolves({
99+
transactions: mockTransactions,
100+
});
104101

105102
const recoveryMultisigStub = sinon
106103
.stub(EnclavedExpressClient.prototype, 'recoveryMultisig')
@@ -154,11 +151,9 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
154151
},
155152
] as any;
156153

157-
const recoverConsolidationsStub = sinon
158-
.stub(Sui.prototype, 'recoverConsolidations')
159-
.resolves({
160-
txRequests: mockTxRequests,
161-
});
154+
const recoverConsolidationsStub = sinon.stub(Sui.prototype, 'recoverConsolidations').resolves({
155+
txRequests: mockTxRequests,
156+
});
162157

163158
const recoveryMPCStub = sinon
164159
.stub(EnclavedExpressClient.prototype, 'recoveryMPC')
@@ -196,15 +191,11 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
196191
});
197192

198193
it('should succeed in handling SOL MPC consolidation recovery', async () => {
199-
const mockTransactions = [
200-
{ txHex: 'unsigned-mpc-tx-1', serializedTx: 'serialized-mpc-tx-1' },
201-
];
194+
const mockTransactions = [{ txHex: 'unsigned-mpc-tx-1', serializedTx: 'serialized-mpc-tx-1' }];
202195

203-
const recoverConsolidationsStub = sinon
204-
.stub(Sol.prototype, 'recoverConsolidations')
205-
.resolves({
206-
transactions: mockTransactions,
207-
});
196+
const recoverConsolidationsStub = sinon.stub(Sol.prototype, 'recoverConsolidations').resolves({
197+
transactions: mockTransactions,
198+
});
208199

209200
const recoveryMPCStub = sinon
210201
.stub(EnclavedExpressClient.prototype, 'recoveryMPC')
@@ -245,11 +236,9 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
245236
{ txHex: 'unsigned-tx-3', serializedTx: 'serialized-unsigned-tx-3' },
246237
];
247238

248-
const recoverConsolidationsStub = sinon
249-
.stub(Trx.prototype, 'recoverConsolidations')
250-
.resolves({
251-
transactions: mockTransactions,
252-
});
239+
const recoverConsolidationsStub = sinon.stub(Trx.prototype, 'recoverConsolidations').resolves({
240+
transactions: mockTransactions,
241+
});
253242

254243
const recoveryMultisigStub = sinon
255244
.stub(EnclavedExpressClient.prototype, 'recoveryMultisig')
@@ -302,7 +291,10 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
302291

303292
response.status.should.equal(500);
304293
response.body.should.have.property('error', 'Internal Server Error');
305-
response.body.should.have.property('details', 'Missing required keys: userPub, backupPub, bitgoPub');
294+
response.body.should.have.property(
295+
'details',
296+
'Missing required keys: userPub, backupPub, bitgoPub',
297+
);
306298
});
307299

308300
it('should fail when required multisigType parameter is missing', async () => {
@@ -335,26 +327,22 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
335327
});
336328

337329
it('should fail when authorization header is missing', async () => {
338-
const response = await agent
339-
.post(`/api/trx/wallet/recoveryconsolidations`)
340-
.send({
341-
multisigType: 'onchain',
342-
userPub: mockUserPub,
343-
backupPub: mockBackupPub,
344-
bitgoPub: mockBitgoPub,
345-
});
330+
const response = await agent.post(`/api/trx/wallet/recoveryconsolidations`).send({
331+
multisigType: 'onchain',
332+
userPub: mockUserPub,
333+
backupPub: mockBackupPub,
334+
bitgoPub: mockBitgoPub,
335+
});
346336

347337
response.status.should.equal(500);
348338
response.body.should.have.property('error', 'Internal Server Error');
349339
response.body.should.have.property('details');
350340
});
351341

352342
it('should succeed in handling empty recovery consolidations result', async () => {
353-
const recoverConsolidationsStub = sinon
354-
.stub(Trx.prototype, 'recoverConsolidations')
355-
.resolves({
356-
transactions: [],
357-
} as any);
343+
const recoverConsolidationsStub = sinon.stub(Trx.prototype, 'recoverConsolidations').resolves({
344+
transactions: [],
345+
} as any);
358346

359347
const response = await agent
360348
.post(`/api/trx/wallet/recoveryconsolidations`)
@@ -374,11 +362,9 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
374362
});
375363

376364
it('should fail when recoverConsolidations returns unexpected result structure', async () => {
377-
const recoverConsolidationsStub = sinon
378-
.stub(Trx.prototype, 'recoverConsolidations')
379-
.resolves({
380-
someOtherProperty: 'value',
381-
} as any);
365+
const recoverConsolidationsStub = sinon.stub(Trx.prototype, 'recoverConsolidations').resolves({
366+
someOtherProperty: 'value',
367+
} as any);
382368

383369
const response = await agent
384370
.post(`/api/trx/wallet/recoveryconsolidations`)
@@ -392,7 +378,10 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
392378

393379
response.status.should.equal(500);
394380
response.body.should.have.property('error', 'Internal Server Error');
395-
response.body.should.have.property('details', 'recoverConsolidations did not return expected transactions');
381+
response.body.should.have.property(
382+
'details',
383+
'recoverConsolidations did not return expected transactions',
384+
);
396385

397386
sinon.assert.calledOnce(recoverConsolidationsStub);
398387
});
@@ -420,15 +409,11 @@ describe('POST /api/:coin/wallet/recoveryconsolidations', () => {
420409
});
421410

422411
it('should fail when enclavedExpressClient throws an error', async () => {
423-
const mockTransactions = [
424-
{ txHex: 'unsigned-tx-1', serializedTx: 'serialized-unsigned-tx-1' },
425-
];
412+
const mockTransactions = [{ txHex: 'unsigned-tx-1', serializedTx: 'serialized-unsigned-tx-1' }];
426413

427-
const recoverConsolidationsStub = sinon
428-
.stub(Trx.prototype, 'recoverConsolidations')
429-
.resolves({
430-
transactions: mockTransactions,
431-
});
414+
const recoverConsolidationsStub = sinon.stub(Trx.prototype, 'recoverConsolidations').resolves({
415+
transactions: mockTransactions,
416+
});
432417

433418
const recoveryMultisigStub = sinon
434419
.stub(EnclavedExpressClient.prototype, 'recoveryMultisig')

0 commit comments

Comments
 (0)