1
- import * as path from 'path' ;
2
1
import AcpClient from "../src/acpClient" ;
3
2
import AcpContractClient from "../src/acpContractClient" ;
4
3
import { baseSepoliaAcpConfig } from "../src/configs" ;
@@ -24,31 +23,31 @@ async function testHelperFunctions() {
24
23
// Get active jobs
25
24
const activeJobs = await acpClient . getActiveJobs ( 1 , 10 ) ;
26
25
console . log ( "\n🔵 Active Jobs:" ) ;
27
- console . log ( activeJobs . data . length > 0 ? activeJobs . data : "No active jobs found." ) ;
26
+ console . log ( activeJobs . length > 0 ? activeJobs : "No active jobs found." ) ;
28
27
29
28
// Get completed jobs
30
29
const completedJobs = await acpClient . getCompletedJobs ( 1 , 10 ) ;
31
30
console . log ( "\n✅ Completed Jobs:" ) ;
32
- console . log ( completedJobs . data . length > 0 ? completedJobs . data : "No completed jobs found." ) ;
31
+ console . log ( completedJobs . length > 0 ? completedJobs : "No completed jobs found." ) ;
33
32
34
33
// Get cancelled jobs
35
34
const cancelledJobs = await acpClient . getCancelledJobs ( 1 , 10 ) ;
36
35
console . log ( "\n❌ Cancelled Jobs:" ) ;
37
- console . log ( cancelledJobs . data . length > 0 ? cancelledJobs . data : "No cancelled jobs found." ) ;
36
+ console . log ( cancelledJobs . length > 0 ? cancelledJobs : "No cancelled jobs found." ) ;
38
37
39
- if ( completedJobs . data . length > 0 ) {
40
- const onChainJobId = completedJobs . data [ 0 ] . onChainJobId ;
38
+ if ( completedJobs . length > 0 ) {
39
+ const onChainJobId = completedJobs [ 0 ] . id ;
41
40
if ( onChainJobId ) {
42
- const job = await acpClient . getJobByOnChainJobId ( onChainJobId ) ;
41
+ const job = await acpClient . getJobById ( onChainJobId ) ;
43
42
console . log ( `\n📄 Job Details (Job ID: ${ onChainJobId } ):` ) ;
44
- console . log ( job . data ) ;
43
+ console . log ( job ) ;
45
44
46
- const memos = completedJobs . data [ 0 ] . memos ;
45
+ const memos = completedJobs [ 0 ] . memos ;
47
46
if ( memos && memos . length > 0 ) {
48
- const memoId = memos [ 0 ] . memoId ;
47
+ const memoId = memos [ 0 ] . id ;
49
48
const memo = await acpClient . getMemoById ( onChainJobId , memoId ) ;
50
49
console . log ( `\n📝 Memo Details (Job ID: ${ onChainJobId } , Memo ID: ${ memoId } ):` ) ;
51
- console . log ( memo . data ) ;
50
+ console . log ( memo ) ;
52
51
} else {
53
52
console . log ( "\n⚠️ No memos found for the completed job." ) ;
54
53
}
@@ -59,7 +58,12 @@ async function testHelperFunctions() {
59
58
}
60
59
61
60
// Run the test
62
- testHelperFunctions ( ) . catch ( error => {
63
- console . error ( "Error in helper functions test:" , error ) ;
64
- process . exit ( 1 ) ;
65
- } ) ;
61
+ testHelperFunctions ( )
62
+ . then ( ( ) => {
63
+ console . log ( "\n✨ Test completed successfully" ) ;
64
+ process . exit ( 0 ) ;
65
+ } )
66
+ . catch ( error => {
67
+ console . error ( "Error in helper functions test:" , error ) ;
68
+ process . exit ( 1 ) ;
69
+ } ) ;
0 commit comments