-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Sep-24] Add tests for
pending_
, completed
and `stellar_transacti…
…on_id` (#117) * [Sep-24] Add tests for 'pending_' and 'completed' transaction * [Sep-24] Add tests for 'stellar_transaction_id' fetching * Add fields descriptions * Clean up * transaction.id should always be a 'string' * Bump version number * Bump to version 0.6.0 instead * More clarity on transaction schema definition * Move schemas around * Make it clear Sep-24 config file is optional * Only display the 'Upload Customer Files' button when it's needed * Fix 'accordian => accordion' typo * Display proper error msg when Sep-24 config object is missing * Rename Sep-24 account params and make publicKey optional
- Loading branch information
Showing
16 changed files
with
1,309 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { Request } from "node-fetch"; | ||
|
||
import { Result, NetworkCall, Failure } from "../types"; | ||
import { makeRequest } from "./request"; | ||
|
||
export const invalidTransactionSchema: Failure = { | ||
name: "invalid transaction schema", | ||
text(args: any): string { | ||
return ( | ||
"The response body returned does not comply with the schema defined for the /transaction endpoint. " + | ||
"The errors returned from the schema validation:\n\n" + | ||
`${args.errors}.` | ||
); | ||
}, | ||
links: { | ||
"Transaction Schema": | ||
"https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0024.md#single-historical-transaction", | ||
}, | ||
}; | ||
|
||
export const unexpectedTransactionStatus: Failure = { | ||
name: "unexpected transaction status", | ||
text(args: any): string { | ||
return `Unexpected transaction status. Expected '${args.expected}' but received '${args.received}' instead.`; | ||
}, | ||
}; | ||
|
||
export const missingConfigFile: Failure = { | ||
name: "missing config file", | ||
text(args: any): string { | ||
return `The ${args.sep} configuration object is missing. Please make sure to upload a config file containing a ${args.sep} configuration object in order for this test to run.`; | ||
}, | ||
}; | ||
|
||
export const invalidConfigFile: Failure = { | ||
name: "invalid config file", | ||
text(args: any): string { | ||
return "The UPLOAD CONFIG file has some issues:\n\n" + `${args.errors}.`; | ||
}, | ||
}; | ||
|
||
export const fetchTransaction = async ({ | ||
transferServerUrl, | ||
transactionId, | ||
stellarTransactionId, | ||
authToken, | ||
result, | ||
}: { | ||
transferServerUrl: string; | ||
transactionId?: string; | ||
stellarTransactionId?: string; | ||
authToken: string; | ||
result: Result; | ||
}) => { | ||
const idQuery = stellarTransactionId | ||
? `stellar_transaction_id=${stellarTransactionId}` | ||
: `id=${transactionId}`; | ||
|
||
const getTransactionCall: NetworkCall = { | ||
request: new Request(transferServerUrl + `/transaction?${idQuery}`, { | ||
headers: { | ||
Authorization: `Bearer ${authToken}`, | ||
}, | ||
}), | ||
}; | ||
result.networkCalls.push(getTransactionCall); | ||
const response = await makeRequest( | ||
getTransactionCall, | ||
200, | ||
result, | ||
"application/json", | ||
); | ||
|
||
return response; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.