Skip to content

Commit

Permalink
Fix remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
casey committed Feb 2, 2024
1 parent c03bbbe commit 66d4e9f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 49 deletions.
10 changes: 9 additions & 1 deletion src/index/updater/rune_updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,15 @@ impl<'a, 'db, 'tx> RuneUpdater<'a, 'db, 'tx> {
mint: mint.and_then(|mint| (!burn).then_some(mint)),
rune,
spacers,
supply: u128::max_value() - balance,
supply: if let Some(mint) = mint {
if mint.end == Some(self.height) {
0
} else {
mint.limit.unwrap_or(runes::MAX_LIMIT)
}
} else {
u128::max_value()
} - balance,
symbol,
timestamp: self.timestamp,
}
Expand Down
5 changes: 0 additions & 5 deletions src/runes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ use {
super::*,
};

// todo:
// - runes::tests::open_etchings_with_term_zero_cannot_be_minted
// - runes::tests::runes_can_be_etched_and_claimed_in_the_same_transaction
// - runes::tests::transactions_cannot_claim_more_than_limit

pub use {edict::Edict, rune::Rune, rune_id::RuneId, runestone::Runestone};

pub(crate) use {etching::Etching, mint::Mint, pile::Pile, spaced_rune::SpacedRune};
Expand Down
8 changes: 2 additions & 6 deletions tests/etch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,13 @@ fn runes_can_be_etched() {

bitcoin_rpc_server.mine_blocks(1);

assert_eq!(
pretty_assert_eq!(
runes(&bitcoin_rpc_server),
vec![(
Rune(RUNE),
RuneInfo {
burned: 0,
mint: Some(MintEntry {
deadline: None,
end: None,
limit: None,
}),
mint: None,
divisibility: 1,
etching: output.transaction,
height: 2,
Expand Down
24 changes: 4 additions & 20 deletions tests/json_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,7 @@ fn get_runes() {
RuneJson {
entry: RuneEntry {
burned: 0,
mint: Some(MintEntry {
limit: None,
end: None,
deadline: None,
}),
mint: None,
divisibility: 0,
etching: a.transaction,
mints: 0,
Expand Down Expand Up @@ -577,11 +573,7 @@ fn get_runes() {
},
RuneEntry {
burned: 0,
mint: Some(MintEntry {
end: None,
limit: None,
deadline: None,
}),
mint: None,
divisibility: 0,
etching: a.transaction,
mints: 0,
Expand All @@ -600,11 +592,7 @@ fn get_runes() {
},
RuneEntry {
burned: 0,
mint: Some(MintEntry {
deadline: None,
end: None,
limit: None,
}),
mint: None,
divisibility: 0,
etching: b.transaction,
mints: 0,
Expand All @@ -623,11 +611,7 @@ fn get_runes() {
},
RuneEntry {
burned: 0,
mint: Some(MintEntry {
deadline: None,
end: None,
limit: None,
}),
mint: None,
divisibility: 0,
etching: c.transaction,
mints: 0,
Expand Down
2 changes: 1 addition & 1 deletion tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use {
inscriptions::InscriptionsJson, output::OutputJson, rune::RuneJson, runes::RunesJson,
sat::SatJson, status::StatusJson, transaction::TransactionJson,
},
Edict, InscriptionId, MintEntry, Rune, RuneEntry, RuneId, Runestone, SatPoint,
Edict, InscriptionId, Rune, RuneEntry, RuneId, Runestone, SatPoint,
},
pretty_assertions::assert_eq as pretty_assert_eq,
regex::Regex,
Expand Down
20 changes: 4 additions & 16 deletions tests/runes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ fn one_rune() {
Rune(RUNE),
RuneInfo {
burned: 0,
mint: Some(MintEntry {
deadline: None,
end: None,
limit: None,
}),
mint: None,
divisibility: 0,
etching: etch.transaction,
height: 2,
Expand Down Expand Up @@ -96,7 +92,7 @@ fn two_runes() {
let a = etch(&bitcoin_rpc_server, &ord_rpc_server, Rune(RUNE));
let b = etch(&bitcoin_rpc_server, &ord_rpc_server, Rune(RUNE + 1));

assert_eq!(
pretty_assert_eq!(
CommandBuilder::new("--index-runes --regtest runes")
.bitcoin_rpc_server(&bitcoin_rpc_server)
.run_and_deserialize_output::<Output>(),
Expand All @@ -106,11 +102,7 @@ fn two_runes() {
Rune(RUNE),
RuneInfo {
burned: 0,
mint: Some(MintEntry {
deadline: None,
end: None,
limit: None,
}),
mint: None,
divisibility: 0,
etching: a.transaction,
height: 2,
Expand All @@ -132,11 +124,7 @@ fn two_runes() {
Rune(RUNE + 1),
RuneInfo {
burned: 0,
mint: Some(MintEntry {
deadline: None,
end: None,
limit: None,
}),
mint: None,
divisibility: 0,
etching: b.transaction,
height: 4,
Expand Down

0 comments on commit 66d4e9f

Please sign in to comment.