Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/__tests__/api/master/generateWallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ describe('POST /api/:coin/wallet/generate', () => {
.send({
label: 'test_wallet',
enterprise: 'test_enterprise',
multisigType: 'onchain',
});

response.status.should.equal(200);
Expand Down Expand Up @@ -485,7 +486,7 @@ describe('POST /api/:coin/wallet/generate', () => {
backupFinalizeNock.done();
addBackupKeyNock.done();
addWalletNock.done();
response.status.should.equal(200); // TODO: Update to 200 when fully integrated with finalize endpoint
response.status.should.equal(200);
});

it('should generate a TSS MPC v2 wallet by calling the enclaved express service', async () => {
Expand Down Expand Up @@ -1137,4 +1138,27 @@ describe('POST /api/:coin/wallet/generate', () => {
(e as Error).message.should.equal('enclavedExpressUrl and enclavedExpressCert are required');
}
});

it('should fail when multisig type is invalid / not provided', async () => {
const response = await agent
.post(`/api/${coin}/wallet/generate`)
.set('Authorization', `Bearer ${accessToken}`)
.send({
label: 'test_wallet',
enterprise: 'test_enterprise',
multisigType: 'invalid',
});

response.status.should.equal(400);

const response2 = await agent
.post(`/api/${coin}/wallet/generate`)
.set('Authorization', `Bearer ${accessToken}`)
.send({
label: 'test_wallet',
enterprise: 'test_enterprise',
});

response2.status.should.equal(400);
});
});
2 changes: 1 addition & 1 deletion src/api/master/routers/masterApiSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const GenerateWalletResponse: HttpResponse = {
// Request type for /generate endpoint
const GenerateWalletRequest = {
label: t.string,
multisigType: t.union([t.undefined, t.literal('onchain'), t.literal('tss')]),
multisigType: t.union([t.literal('onchain'), t.literal('tss')]),
enterprise: t.string,
disableTransactionNotifications: t.union([t.undefined, t.boolean]),
isDistributedCustody: t.union([t.undefined, t.boolean]),
Expand Down