Created
February 19, 2022 16:33
-
-
Save mhassanist/1b0c395c17be98a7066dad1253bd886d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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