Skip to content

Commit 11d8430

Browse files
committed
refactor: added decoding to UT
TICKET: WP-5445
1 parent 27970d4 commit 11d8430

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test';
22
import { BitGo } from 'bitgo';
3-
import { common } from '@bitgo/sdk-core';
3+
import { common, decodeOrElse } from '@bitgo/sdk-core';
44
import nock from 'nock';
55
import * as express from 'express';
66
import * as sinon from 'sinon';
77
import * as fs from 'fs';
8+
import { SignerMacaroonResponse } from '../../../../src/typedRoutes/api/v2/signerMacaroon';
89

910
import { lightningSignerConfigs, apiData, signerApiData } from './lightningSignerFixture';
1011
import {
@@ -133,7 +134,10 @@ describe('Lightning signer routes', () => {
133134
} as unknown as ExpressApiRouteRequest<'express.lightning.signerMacaroon', 'post'>;
134135

135136
try {
136-
await handleCreateSignerMacaroon(req);
137+
const res = await handleCreateSignerMacaroon(req);
138+
decodeOrElse('PostLightningInitWallet.response.200', SignerMacaroonResponse[200], res, (_) => {
139+
throw new Error('Response did not match expected codec');
140+
});
137141
} catch (e) {
138142
if (!includeWatchOnlyIp || addIpCaveatToMacaroon) {
139143
throw e;

0 commit comments

Comments
 (0)