Skip to content

Commit e48a4cc

Browse files
committed
test: added rosetta tests
1 parent bb95566 commit e48a4cc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/tests-rosetta/api.ts

+12
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ import { getStacksTestnetNetwork, testnetKeys } from '../api/routes/debug';
7070
import {
7171
getSignature,
7272
getStacksNetwork,
73+
makePresignHash,
7374
} from '../rosetta-helpers';
7475
import { makeSigHashPreSign, MessageSignature } from '@stacks/transactions';
7576
import { decodeBtcAddress } from '@stacks/stacking';
@@ -2356,6 +2357,17 @@ describe('Rosetta API', () => {
23562357
const expectedResponse = RosettaErrors[RosettaErrorsTypes.signatureNotVerified];
23572358

23582359
expect(JSON.parse(result.text)).toEqual(expectedResponse);
2360+
2361+
// testing undefined signature
2362+
const incorrectTransaction = unsignedTransaction;
2363+
delete incorrectTransaction.auth.spendingCondition;
2364+
const undefinedSignature = getSignature(incorrectTransaction);
2365+
expect(undefinedSignature).toBe(undefined);
2366+
2367+
// testing undefined pre sign hash
2368+
delete incorrectTransaction.auth.authType;
2369+
const undefinedPreSignHash = makePresignHash(incorrectTransaction);
2370+
expect(undefinedPreSignHash).toBe(undefined);
23592371
});
23602372

23612373
test('combine invalid public key', async () => {

0 commit comments

Comments
 (0)