Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shawntabrizi committed Sep 13, 2024
1 parent d9a4c46 commit 038853f
Show file tree
Hide file tree
Showing 40 changed files with 108 additions and 308 deletions.
5 changes: 0 additions & 5 deletions steps/15/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,5 @@ fn mint_increments_count_for_kitty() {
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), Some(1));
// Let's call it two more times...
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(2)));
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(3)));
// Now the storage should be `Some(3)`
assert_eq!(CountForKitties::<TestRuntime>::get(), Some(3));
})
}
5 changes: 0 additions & 5 deletions steps/16/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,5 @@ fn mint_increments_count_for_kitty() {
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), Some(1));
// Let's call it two more times...
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(2)));
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(3)));
// Now the storage should be `Some(3)`
assert_eq!(CountForKitties::<TestRuntime>::get(), Some(3));
})
}
5 changes: 0 additions & 5 deletions steps/17/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ fn mint_increments_count_for_kitty() {
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), Some(1));
// Let's call it two more times...
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(2)));
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(3)));
// Now the storage should be `Some(3)`
assert_eq!(CountForKitties::<TestRuntime>::get(), Some(3));
})
}

Expand Down
5 changes: 0 additions & 5 deletions steps/18/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,6 @@ fn mint_increments_count_for_kitty() {
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), Some(1));
// Let's call it two more times...
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(2)));
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(3)));
// Now the storage should be `Some(3)`
assert_eq!(CountForKitties::<TestRuntime>::get(), Some(3));
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/19/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/20/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/21/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/22/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/23/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/24/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/25/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/26/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/27/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/28/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/29/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/30/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/31/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/32/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/33/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/34/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/35/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
11 changes: 3 additions & 8 deletions steps/36/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ fn mint_increments_count_for_kitty() {
new_test_ext().execute_with(|| {
// Querying storage before anything is set will return `0`.
assert_eq!(CountForKitties::<TestRuntime>::get(), 0);
// Call `mint` to create a new kitty.
assert_ok!(PalletKitties::mint(1, [1u8; 32]));
// Now the storage should be `1`
// Call `create_kitty` which will call `mint`.
assert_ok!(PalletKitties::create_kitty(RuntimeOrigin::signed(1)));
// Now the storage should be `Some(1)`
assert_eq!(CountForKitties::<TestRuntime>::get(), 1);
// Let's call it two more times...
assert_ok!(PalletKitties::mint(2, [2u8; 32]));
assert_ok!(PalletKitties::mint(3, [3u8; 32]));
// Now the storage should be `3`
assert_eq!(CountForKitties::<TestRuntime>::get(), 3);
})
}

Expand Down
Loading

0 comments on commit 038853f

Please sign in to comment.