Skip to content

Commit fe3cfaf

Browse files
authored
test(express): refactor few test cases
2 parents 6003e2e + 50b3b3d commit fe3cfaf

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

modules/express/test/unit/typedRoutes/signTransaction.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ describe('SignTransaction codec tests', function () {
849849
.send(requestBody);
850850

851851
// Should fail with authentication error
852-
assert.ok(result.status === 401 || result.status >= 500);
852+
assert.strictEqual(result.status, 401);
853853
});
854854
});
855855

@@ -963,8 +963,9 @@ describe('SignTransaction codec tests', function () {
963963
.set('Content-Type', 'application/json')
964964
.send(requestBody);
965965

966-
// Should handle empty strings - might pass validation but fail in signing
967-
assert.ok(result.status >= 400 || result.status === 200);
966+
// Should fail with server error due to invalid transaction data
967+
assert.strictEqual(result.status, 500);
968+
result.body.should.have.property('error');
968969
});
969970

970971
it('should handle very long transaction hex', async function () {
@@ -1000,8 +1001,9 @@ describe('SignTransaction codec tests', function () {
10001001
.set('Content-Type', 'application/json')
10011002
.send(requestBody);
10021003

1003-
// Should handle large payload
1004-
assert.ok(result.status === 200 || result.status >= 400);
1004+
// Should handle large payload successfully
1005+
assert.strictEqual(result.status, 200);
1006+
assert.strictEqual(mockWallet.signTransaction.calledOnce, true);
10051007
});
10061008

10071009
it('should handle large number of unspents', async function () {
@@ -1038,8 +1040,9 @@ describe('SignTransaction codec tests', function () {
10381040
.set('Content-Type', 'application/json')
10391041
.send(requestBody);
10401042

1041-
// Should handle large unspents array
1042-
assert.ok(result.status === 200 || result.status >= 400);
1043+
// Should handle large unspents array successfully
1044+
assert.strictEqual(result.status, 200);
1045+
assert.strictEqual(mockWallet.signTransaction.calledOnce, true);
10431046
});
10441047

10451048
it('should handle unspents with complex objects', async function () {
@@ -1080,8 +1083,9 @@ describe('SignTransaction codec tests', function () {
10801083
.set('Content-Type', 'application/json')
10811084
.send(requestBody);
10821085

1083-
// Should handle additional properties in unspents
1084-
assert.ok(result.status === 200 || result.status >= 400);
1086+
// Should handle additional properties in unspents successfully
1087+
assert.strictEqual(result.status, 200);
1088+
assert.strictEqual(mockWallet.signTransaction.calledOnce, true);
10851089
});
10861090

10871091
it('should handle keychain with many additional properties', async function () {

0 commit comments

Comments
 (0)