-
Notifications
You must be signed in to change notification settings - Fork 0
/
testAdoption.test.js
32 lines (23 loc) · 1.03 KB
/
testAdoption.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { assert } = require("console");
const Adoption = artifacts.require("Adoption");
_deploy_contracts("Adoption", (accounts) => {
let adoption;
let expectedAdopters;
before(async () => {
adoption = await Adoption.deployed();
});
describe("adopting a pet and retrieving account address" , async() > {
before("adopt a pet using account[0]" , async() =>{
await adoption.adopt(8, {from.accounts[0]});
expectedAdopter = accounts[0];
});
it("can fetch the adddress of an owner by pet id" , async () =>{
const adopter = await adoption.adopters(8);
assert.equal(adopter,expectedAdopter,"This owner of the adopter pet should be the first account.");
});
it("can fetch the collection of all pet owner addresses" , async() =>{
const adopters = await adoption.getAdopters();
assert.equal(adopters[8],expectedAdopter , "The owner of the adopted pet should be")
});
});
});