Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

[ABO-140] Create a test for Season 2 Avatar and NFT Transfer #339

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions pallets/ajuna-awesome-avatars/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3199,7 +3199,10 @@ mod nft_transfer {

#[test]
fn can_lock_avatar_successfully() {
let season = Season::default().max_components(8).max_variations(5);
let season = Season::default()
.mint_logic(LogicGeneration::Second)
.max_components(8)
.max_variations(5);

ExtBuilder::default()
.seasons(&[(SEASON_ID, season.clone())])
Expand Down Expand Up @@ -3238,9 +3241,13 @@ mod nft_transfer {
avatar,
Avatar {
season_id: 1,
dna: bounded_vec![0x20, 0x20, 0x23, 0x22, 0x10, 0x32, 0x12, 0x10],
souls: 34,
encoding: DnaEncoding::V1,
dna: bounded_vec![
0x24, 0x00, 0x41, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
],
souls: 60,
encoding: DnaEncoding::V2,
}
);

Expand All @@ -3260,8 +3267,8 @@ mod nft_transfer {
Avatar::get_attribute_codes().iter().zip([
avatar.dna.encode(),
avatar.souls.encode(),
RarityTier::Common.encode(),
Force::Kinetic.encode(),
avatar.rarity().encode(),
avatar.force().encode(),
]) {
assert_eq!(
<Nft as Inspect<MockAccountId>>::system_attribute(
Expand Down
1 change: 1 addition & 0 deletions pallets/ajuna-awesome-avatars/src/types/avatar/force.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl fmt::Display for Force {
impl ByteConvertible for Force {
fn from_byte(byte: u8) -> Self {
match byte {
0 => Self::Null,
1 => Self::Kinetic,
2 => Self::Dream,
3 => Self::Solar,
Expand Down
4 changes: 4 additions & 0 deletions pallets/ajuna-awesome-avatars/src/types/season.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ mod test {
self.fee.prepare_avatar = fee;
self
}
pub fn mint_logic(mut self, logic: LogicGeneration) -> Self {
self.mint_logic = logic;
self
}
}

impl SeasonStatus {
Expand Down