Skip to content

Commit

Permalink
⚡ Improve example and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielePicco committed Feb 20, 2024
1 parent 019d470 commit 12cd908
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 0 additions & 2 deletions examples/system-simple-movement/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use bolt_lang::*;
use std::str::FromStr;

declare_id!("FSa6qoJXFBR3a7ThQkTAMrC15p6NkchPEjBdd4n6dXxA");

#[system]
pub mod system_simple_movement {
use std::io::Write;

pub fn execute(ctx: Context<Components>, args_p: Vec<u8>) -> Result<Components> {
let args = parse_args::<Args>(&args_p);
Expand Down
19 changes: 8 additions & 11 deletions tests/bolt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { type World } from "../target/types/world";
import { expect } from "chai";
import BN from "bn.js";
import {
createInitializeRegistryInstruction,
FindComponentPda,
FindEntityPda,
FindWorldPda,
Expand All @@ -35,10 +36,6 @@ function serializeArgs(args: any = {}) {
);
}

const SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey(
"Sysvar1nstructions1111111111111111111111111"
);

describe("bolt", () => {
const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider);
Expand Down Expand Up @@ -70,13 +67,13 @@ describe("bolt", () => {

it("InitializeWorldsRegistry", async () => {
const registryPda = FindWorldRegistryPda(worldProgram.programId);
await worldProgram.methods
.initializeRegistry()
.accounts({
registry: registryPda,
payer: provider.wallet.publicKey,
})
.rpc();
const initializeRegistryIx = createInitializeRegistryInstruction({
registry: registryPda,
payer: provider.wallet.publicKey,
});

const tx = new anchor.web3.Transaction().add(initializeRegistryIx);
await provider.sendAndConfirm(tx);
});

it("InitializeNewWorld", async () => {
Expand Down

0 comments on commit 12cd908

Please sign in to comment.