context("Test the post transaction (simple)")
body = "AAAAABYNKU6c4ROssxuqKACreDTSHszRk+6QjoN/5j7/aCdPAAA4pACk9+IAAAADAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAADHlvdXJNdW1zQXJzZQAAAAEAAAAAAAAAAQAAAACdpD9sS2jlS4+g0cF9ZjMgNJrm2J2L7tIPDnaA6sV7hQAAAAAAAAAATXxtAAAAAAAAAAAB/2gnTwAAAEAkjv4/L4hSS2HMzEk0u+sXATKfQVjZr3ja1KZoQd22Ivf1hXTHERS5hF86wEhiCxPL5i0HQBpkrnZMynoDshwP"
test_that("Transaction details are returned.", {
txn = postTransaction(body, domain = domain)
expect_named(txn, c("_links", "hash", "ledger", "envelope_xdr", "result_xdr", "result_meta_xdr"))
expect_equal(txn$ledger, 10847297)
expect_equal(txn$envelope_xdr, body)
post_link = sprintf("https://horizon-testnet.stellar.org/transactions/%s", txn$hash)
expect_equal(as.character(txn[['_links']]), post_link)
})
test_that("Changing the body returns an invalid XDR response.", {
bad_body = paste0(body, "AA")
response = postTransaction(bad_body, domain = domain)
expect_named(response, c("type", "title", "status", "detail", "extras"))
expect_equal(response$status, 400)
expect_true(grepl("^Horizon could not decode the transaction envelope in this request\\.",
response$detail))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.