Skip to content

Commit

Permalink
feat: adding burn test suites for ref tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
HinsonSIDAN committed Nov 26, 2023
1 parent a7dc4af commit 0e285c9
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
56 changes: 56 additions & 0 deletions validators/content_registry_ref_token.ak
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,59 @@ test fail_mint_with_unclean_registry_value() {
let ctx = ScriptContext { purpose: Mint(mock_policy_id()), transaction: tx }
!content_registry_ref_token(mock_policy_id(), redeemer, ctx)
}

test success_burn() {
let redeemer = RBurn
let policy_id = mock_policy_id()

let tx =
Transaction {
..placeholder(),
mint: to_minted_value(from_asset(policy_id, "", -1)),
}
let ctx = ScriptContext { purpose: Mint(policy_id), transaction: tx }
content_registry_ref_token(mock_policy_id(), redeemer, ctx)
}

test success_burn_with_other_minting() {
let redeemer = RBurn
let policy_id = mock_policy_id()

let tx =
Transaction {
..placeholder(),
mint: to_minted_value(
from_asset(policy_id, "", -1) |> add(mock_policy_id_2(), "", 1),
),
}
let ctx = ScriptContext { purpose: Mint(policy_id), transaction: tx }
content_registry_ref_token(mock_policy_id(), redeemer, ctx)
}

test fail_burn_with_mint() {
let redeemer = RBurn
let policy_id = mock_policy_id()

let tx =
Transaction {
..placeholder(),
mint: to_minted_value(from_asset(policy_id, "", 1)),
}
let ctx = ScriptContext { purpose: Mint(policy_id), transaction: tx }
!content_registry_ref_token(mock_policy_id(), redeemer, ctx)
}

test fail_burn_with_mix() {
let redeemer = RBurn
let policy_id = mock_policy_id()

let tx =
Transaction {
..placeholder(),
mint: to_minted_value(
from_asset(policy_id, "", -1) |> add(policy_id, "1", 1),
),
}
let ctx = ScriptContext { purpose: Mint(policy_id), transaction: tx }
!content_registry_ref_token(mock_policy_id(), redeemer, ctx)
}
56 changes: 56 additions & 0 deletions validators/ownership_registry_ref_token.ak
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,59 @@ test fail_mint_with_unclean_registry_value() {
let ctx = ScriptContext { purpose: Mint(mock_policy_id()), transaction: tx }
!ownership_registry_ref_token(mock_policy_id(), redeemer, ctx)
}

test success_burn() {
let redeemer = RBurn
let policy_id = mock_policy_id()

let tx =
Transaction {
..placeholder(),
mint: to_minted_value(from_asset(policy_id, "", -1)),
}
let ctx = ScriptContext { purpose: Mint(policy_id), transaction: tx }
ownership_registry_ref_token(mock_policy_id(), redeemer, ctx)
}

test success_burn_with_other_minting() {
let redeemer = RBurn
let policy_id = mock_policy_id()

let tx =
Transaction {
..placeholder(),
mint: to_minted_value(
from_asset(policy_id, "", -1) |> add(mock_policy_id_2(), "", 1),
),
}
let ctx = ScriptContext { purpose: Mint(policy_id), transaction: tx }
ownership_registry_ref_token(mock_policy_id(), redeemer, ctx)
}

test fail_burn_with_mint() {
let redeemer = RBurn
let policy_id = mock_policy_id()

let tx =
Transaction {
..placeholder(),
mint: to_minted_value(from_asset(policy_id, "", 1)),
}
let ctx = ScriptContext { purpose: Mint(policy_id), transaction: tx }
!ownership_registry_ref_token(mock_policy_id(), redeemer, ctx)
}

test fail_burn_with_mix() {
let redeemer = RBurn
let policy_id = mock_policy_id()

let tx =
Transaction {
..placeholder(),
mint: to_minted_value(
from_asset(policy_id, "", -1) |> add(policy_id, "1", 1),
),
}
let ctx = ScriptContext { purpose: Mint(policy_id), transaction: tx }
!ownership_registry_ref_token(mock_policy_id(), redeemer, ctx)
}

0 comments on commit 0e285c9

Please sign in to comment.