2022-12-16 05:21:50 -08:00
|
|
|
import * as anchor from "@coral-xyz/anchor";
|
|
|
|
import { AnchorError, Program } from "@coral-xyz/anchor";
|
2022-03-20 17:29:12 -07:00
|
|
|
import splToken from "@solana/spl-token";
|
|
|
|
import { DeclareId } from "../target/types/declare_id";
|
|
|
|
import { assert } from "chai";
|
|
|
|
|
|
|
|
describe("declare_id", () => {
|
2022-04-11 12:48:58 -07:00
|
|
|
anchor.setProvider(anchor.AnchorProvider.local());
|
2022-03-20 17:29:12 -07:00
|
|
|
const program = anchor.workspace.DeclareId as Program<DeclareId>;
|
|
|
|
|
|
|
|
it("throws error!", async () => {
|
|
|
|
try {
|
2022-04-17 12:54:28 -07:00
|
|
|
await program.methods.initialize().rpc();
|
2022-03-20 17:29:12 -07:00
|
|
|
assert.ok(false);
|
|
|
|
} catch (_err) {
|
2022-03-24 08:44:33 -07:00
|
|
|
assert.isTrue(_err instanceof AnchorError);
|
2022-03-20 17:29:12 -07:00
|
|
|
const err: AnchorError = _err;
|
2022-03-24 08:44:33 -07:00
|
|
|
assert.strictEqual(err.error.errorCode.number, 4100);
|
2022-03-20 17:29:12 -07:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|