Skip to content

Commit

Permalink
tests: add publisher keep to account.move
Browse files Browse the repository at this point in the history
  • Loading branch information
thounyy committed Oct 18, 2024
1 parent 2889ff1 commit f1a2170
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/protocol/sources/account.move
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use sui::{
transfer::Receiving,
clock::Clock,
dynamic_field as df,
package,
};
use account_protocol::{
issuer,
Expand All @@ -36,6 +37,8 @@ use account_extensions::extensions::Extensions;

// === Structs ===

public struct ACCOUNT has drop {}

/// Shared multisig Account object
public struct Account<Config, Outcome> has key {
id: UID,
Expand All @@ -53,6 +56,10 @@ public struct Account<Config, Outcome> has key {

// === Public mutative functions ===

fun init(otw: ACCOUNT, ctx: &mut TxContext) {
package::claim_and_keep(otw, ctx);
}

/// Creates a new Account object, called from AccountConfig
public fun new<Config, Outcome>(
extensions: &Extensions,
Expand Down Expand Up @@ -296,4 +303,11 @@ public fun proposal_mut<Config, Outcome>(
): &mut Proposal<Outcome> {
account.deps.assert_is_core_dep(version);
account.proposals.get_mut(key)
}

// === Test functions ===

#[test_only]
public fun init_for_testing(ctx: &mut TxContext) {
init(ACCOUNT {}, ctx);
}
1 change: 1 addition & 0 deletions packages/protocol/tests/account_tests.move
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ fun start(): (Scenario, Extensions, Account<bool, bool>) {
let mut scenario = ts::begin(OWNER);
// publish package
extensions::init_for_testing(scenario.ctx());
account::init_for_testing(scenario.ctx());
// retrieve objects
scenario.next_tx(OWNER);
let mut extensions = scenario.take_shared<Extensions>();
Expand Down

0 comments on commit f1a2170

Please sign in to comment.