-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtxt.txt
54 lines (40 loc) · 1.64 KB
/
txt.txt
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
6Lci3IwnAAAAAHyAFNBtYQuHFbKWYuF6m2uhFVKb
describe('Game creation', () => {
it('should confirm fetching games', async () => {
result = await contract.getGames()
expect(result).to.have.lengthOf(1)
})
it('should confirm fetching a single game', async () => {
result = await contract.getGame(gameId)
expect(result.id).to.be.equal(1)
})
it('should confirm listing of a players invitations', async () => {
result = await contract.connect(user1).getInvitations()
expect(result).to.have.lengthOf(0)
await contract.invitePlayer(user1.address, gameId)
await contract.invitePlayer(user2.address, gameId)
result = await contract.connect(user1).getInvitations()
expect(result).to.have.lengthOf(1)
await contract.connect(user1).acceptInvitation(1, {
value: toWei(stake),
})
result = await contract.isPlayerListed(gameId, user1.address)
expect(result).to.be.true
await contract.connect(user2).rejectInvitation(gameId)
result = await contract.isPlayerListed(gameId, user2.address)
expect(result).to.be.false
})
it('should confirm payouts', async () => {
await contract.invitePlayer(user1.address, gameId)
await contract.connect(user1).acceptInvitation(gameId, {
value: toWei(stake),
})
await contract.recordScore(gameId, 23)
await contract.connect(user1).recordScore(gameId, 19)
result = await contract.getGame(gameId)
expect(result.paidOut).to.be.false
await contract.payout(gameId)
result = await contract.getGame(gameId)
expect(result.paidOut).to.be.true
})
})