Make 'simple_spend_no_datum' acceptance test more to-the-point
This new acceptance test is really meant to check for the behavior surrounding the optional datum. So I've added an extra expect on the received datum, and kept only assertions that were about or related to the datum.
This commit is contained in:
parent
8a3bbfc89a
commit
6413f2c1cc
|
@ -1,33 +1,19 @@
|
||||||
use aiken/collection/dict
|
use aiken/collection/dict
|
||||||
use cardano/address.{Address, Script}
|
use cardano/address.{Address, Script}
|
||||||
use cardano/assets
|
use cardano/assets
|
||||||
use cardano/transaction.{
|
use cardano/transaction.{Input, NoDatum, Output, OutputReference, Transaction}
|
||||||
Input, NoDatum, Output, OutputReference, ScriptPurpose, Spend, Transaction,
|
|
||||||
}
|
|
||||||
|
|
||||||
validator simple_spend {
|
validator simple_spend {
|
||||||
spend(
|
spend(
|
||||||
_datum: Option<Void>,
|
datum: Option<Void>,
|
||||||
_redeemer: Void,
|
_redeemer: Void,
|
||||||
output_ref: OutputReference,
|
_output_ref: OutputReference,
|
||||||
transaction: Transaction,
|
transaction: Transaction,
|
||||||
) {
|
) {
|
||||||
assert_transaction_id(transaction.id)
|
expect None = datum
|
||||||
|
|
||||||
assert_script_info(output_ref)
|
|
||||||
|
|
||||||
assert_inputs(transaction.inputs)
|
assert_inputs(transaction.inputs)
|
||||||
|
|
||||||
expect [] = transaction.outputs
|
|
||||||
|
|
||||||
expect [] = transaction.reference_inputs
|
|
||||||
|
|
||||||
expect [] = transaction.extra_signatories
|
|
||||||
|
|
||||||
expect 42 == transaction.fee
|
|
||||||
|
|
||||||
assert_redeemers(transaction.redeemers)
|
|
||||||
|
|
||||||
expect [] == dict.to_pairs(transaction.datums)
|
expect [] == dict.to_pairs(transaction.datums)
|
||||||
|
|
||||||
True
|
True
|
||||||
|
@ -38,21 +24,6 @@ validator simple_spend {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_transaction_id(id: ByteArray) {
|
|
||||||
expect
|
|
||||||
#"c6fbd346681a8f8337f6b3e51e6ec973f1509367eabc3a44c849af58a1d8471b" == id
|
|
||||||
Void
|
|
||||||
}
|
|
||||||
|
|
||||||
fn assert_script_info(info: OutputReference) {
|
|
||||||
expect
|
|
||||||
OutputReference {
|
|
||||||
transaction_id: #"0000000000000000000000000000000000000000000000000000000000000000",
|
|
||||||
output_index: 0,
|
|
||||||
} == info
|
|
||||||
Void
|
|
||||||
}
|
|
||||||
|
|
||||||
fn assert_inputs(inputs: List<Input>) {
|
fn assert_inputs(inputs: List<Input>) {
|
||||||
expect [
|
expect [
|
||||||
Input {
|
Input {
|
||||||
|
@ -76,24 +47,3 @@ fn assert_inputs(inputs: List<Input>) {
|
||||||
|
|
||||||
Void
|
Void
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assert_redeemers(redeemers: Pairs<ScriptPurpose, Data>) {
|
|
||||||
expect
|
|
||||||
[
|
|
||||||
Pair(
|
|
||||||
Spend(
|
|
||||||
OutputReference {
|
|
||||||
transaction_id: #"0000000000000000000000000000000000000000000000000000000000000000",
|
|
||||||
output_index: 0,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
void(),
|
|
||||||
),
|
|
||||||
] == redeemers
|
|
||||||
Void
|
|
||||||
}
|
|
||||||
|
|
||||||
fn void() -> Data {
|
|
||||||
let void: Data = Void
|
|
||||||
void
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue