Skip to content

Commit 644435a

Browse files
committed
refactor: added decoding to UT
TICKET: WP-5445
1 parent ec5453a commit 644435a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/express/test/unit/clientRoutes/lightning/lightningSignerRoutes.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test';
22
import { BitGo } from 'bitgo';
33
import { common, decodeOrElse } from '@bitgo/sdk-core';
44
import nock from 'nock';
5-
import * as express from 'express';
65
import * as sinon from 'sinon';
76
import * as fs from 'fs';
87
import { UnlockLightningWalletResponse } from '../../../../src/typedRoutes/api/v2/unlockWallet';
9-
8+
import { SignerMacaroonResponse } from '../../../../src/typedRoutes/api/v2/signerMacaroon';
109
import { lightningSignerConfigs, apiData, signerApiData } from './lightningSignerFixture';
1110
import {
1211
handleCreateSignerMacaroon,
@@ -145,7 +144,10 @@ describe('Lightning signer routes', () => {
145144
} as unknown as ExpressApiRouteRequest<'express.lightning.signerMacaroon', 'post'>;
146145

147146
try {
148-
await handleCreateSignerMacaroon(req);
147+
const res = await handleCreateSignerMacaroon(req);
148+
decodeOrElse('PostLightningInitWallet.response.200', SignerMacaroonResponse[200], res, (_) => {
149+
throw new Error('Response did not match expected codec');
150+
});
149151
} catch (e) {
150152
if (!includeWatchOnlyIp || addIpCaveatToMacaroon) {
151153
throw e;

0 commit comments

Comments
 (0)