Skip to content

Instantly share code, notes, and snippets.

@mhassanist
Created February 19, 2022 16:33
Show Gist options
  • Save mhassanist/1b0c395c17be98a7066dad1253bd886d to your computer and use it in GitHub Desktop.
Save mhassanist/1b0c395c17be98a7066dad1253bd886d to your computer and use it in GitHub Desktop.
//import your contract code
import { Contract } from "../assembly";
//take an instance of the contract
let contract: Contract;
//make sure the instance is properly created
beforeAll(() => {
contract = new Contract();
});
describe("Creating an organization", () => {
it("Creating an organization", () => {
expect(
contract.addOrganization(
"ABCAcademy",
"ABCAcademy",
"From zero to hero training"
)
).toBe(
"Organization created with code= " +
"ABCACADEMY" +
" and name= " +
"ABCAcademy"
);
expect(contract.addOrganization("Yahoo", "Yahoo", "Used to be")).toBe(
"Organization created with code= " + "YAHOO" + " and name= " + "Yahoo"
);
});
it("should count 2 and refuse adding org with same name", () => {
expect(contract.orgCount).toBe(2);
expect(contract.addOrganization("Yahoo", "Yahoo", "Used to be")).toBe(
"Organization with the same code already there"
);
expect(contract.orgCount).toBe(2);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment