Skip to content

Commit 7f2ed04

Browse files
author
Yash Agrawal
committed
fix: get mint test cases working again
1 parent e7a12d2 commit 7f2ed04

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

test/SBT.test.ts

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,17 @@ describe('SBT', () => {
9696
sbt.connect(signers.minterA).mint(signers.userA.address, metadata)
9797
)
9898
.to.emit(sbt, 'Minted')
99-
.withArgs(0, signers.userA.address)
99+
.withArgs(1, signers.userA.address)
100100

101101
const tokensOfUserA = await sbt.tokensOfOwner(signers.userA.address)
102102
expect(tokensOfUserA.length).to.eq(1)
103-
expect(tokensOfUserA[0]).to.eq(0)
103+
expect(tokensOfUserA[0]).to.eq(1)
104104
expect(await sbt.totalSupply()).to.eq(1)
105105
expect(await sbt.currentIndex()).to.eq(1)
106-
expect(await sbt.ownerOf(0)).to.eq(signers.userA.address)
106+
expect(await sbt.ownerOf(1)).to.eq(signers.userA.address)
107107
expect(await sbt.balanceOf(signers.userA.address)).to.eq(1)
108-
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 0)).to.eq(0)
109-
expect(await sbt.tokenByIndex(0)).to.eq(0)
108+
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 0)).to.eq(1)
109+
expect(await sbt.tokenByIndex(0)).to.eq(1)
110110
})
111111

112112
it('The mint function can be executed by minter', async () => {
@@ -147,27 +147,27 @@ describe('SBT', () => {
147147
sbt.connect(signers.minterA).mint(signers.userA.address, metadata)
148148
)
149149
.to.emit(sbt, 'Minted')
150-
.withArgs(0, signers.userA.address)
150+
.withArgs(1, signers.userA.address)
151151
// Execute by Minter B.
152152
await expect(
153153
sbt.connect(signers.minterB).mint(signers.userA.address, metadata)
154154
)
155155
.to.emit(sbt, 'Minted')
156-
.withArgs(1, signers.userA.address)
156+
.withArgs(2, signers.userA.address)
157157

158158
const tokensOfUserA = await sbt.tokensOfOwner(signers.userA.address)
159159
expect(tokensOfUserA.length).to.eq(2)
160-
expect(tokensOfUserA[0]).to.eq(0)
161-
expect(tokensOfUserA[1]).to.eq(1)
160+
expect(tokensOfUserA[0]).to.eq(1)
161+
expect(tokensOfUserA[1]).to.eq(2)
162162
expect(await sbt.totalSupply()).to.eq(2)
163163
expect(await sbt.currentIndex()).to.eq(2)
164-
expect(await sbt.ownerOf(0)).to.eq(signers.userA.address)
165164
expect(await sbt.ownerOf(1)).to.eq(signers.userA.address)
165+
expect(await sbt.ownerOf(2)).to.eq(signers.userA.address)
166166
expect(await sbt.balanceOf(signers.userA.address)).to.eq(2)
167-
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 0)).to.eq(0)
168-
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 1)).to.eq(1)
169-
expect(await sbt.tokenByIndex(0)).to.eq(0)
170-
expect(await sbt.tokenByIndex(1)).to.eq(1)
167+
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 0)).to.eq(1)
168+
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 1)).to.eq(2)
169+
expect(await sbt.tokenByIndex(0)).to.eq(1)
170+
expect(await sbt.tokenByIndex(1)).to.eq(2)
171171
})
172172

173173
it('The mint function can be executed by all minters', async () => {
@@ -183,37 +183,37 @@ describe('SBT', () => {
183183
sbt.connect(signers.minterA).mint(signers.userA.address, metadata)
184184
)
185185
.to.emit(sbt, 'Minted')
186-
.withArgs(0, signers.userA.address)
186+
.withArgs(1, signers.userA.address)
187187
// Execute by Minter B.
188188
await expect(
189189
sbt.connect(signers.minterB).mint(signers.userA.address, metadata)
190190
)
191191
.to.emit(sbt, 'Minted')
192-
.withArgs(1, signers.userA.address)
192+
.withArgs(2, signers.userA.address)
193193
// Execute by Minter C.
194194
await expect(
195195
sbt.connect(signers.minterC).mint(signers.userA.address, metadata)
196196
)
197197
.to.emit(sbt, 'Minted')
198-
.withArgs(2, signers.userA.address)
198+
.withArgs(3, signers.userA.address)
199199

200200
const tokensOfUserA = await sbt.tokensOfOwner(signers.userA.address)
201201
expect(tokensOfUserA.length).to.eq(3)
202-
expect(tokensOfUserA[0]).to.eq(0)
203-
expect(tokensOfUserA[1]).to.eq(1)
204-
expect(tokensOfUserA[2]).to.eq(2)
202+
expect(tokensOfUserA[0]).to.eq(1)
203+
expect(tokensOfUserA[1]).to.eq(2)
204+
expect(tokensOfUserA[2]).to.eq(3)
205205
expect(await sbt.totalSupply()).to.eq(3)
206206
expect(await sbt.currentIndex()).to.eq(3)
207-
expect(await sbt.ownerOf(0)).to.eq(signers.userA.address)
208207
expect(await sbt.ownerOf(1)).to.eq(signers.userA.address)
209208
expect(await sbt.ownerOf(2)).to.eq(signers.userA.address)
209+
expect(await sbt.ownerOf(3)).to.eq(signers.userA.address)
210210
expect(await sbt.balanceOf(signers.userA.address)).to.eq(3)
211-
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 0)).to.eq(0)
212-
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 1)).to.eq(1)
213-
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 2)).to.eq(2)
214-
expect(await sbt.tokenByIndex(0)).to.eq(0)
215-
expect(await sbt.tokenByIndex(1)).to.eq(1)
216-
expect(await sbt.tokenByIndex(2)).to.eq(2)
211+
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 0)).to.eq(1)
212+
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 1)).to.eq(2)
213+
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 2)).to.eq(3)
214+
expect(await sbt.tokenByIndex(0)).to.eq(1)
215+
expect(await sbt.tokenByIndex(1)).to.eq(2)
216+
expect(await sbt.tokenByIndex(2)).to.eq(3)
217217
})
218218

219219
it('The mint function should function correctly for multiple users', async () => {
@@ -225,43 +225,43 @@ describe('SBT', () => {
225225
sbt.connect(signers.minterA).mint(signers.userA.address, metadata)
226226
)
227227
.to.emit(sbt, 'Minted')
228-
.withArgs(0, signers.userA.address)
228+
.withArgs(1, signers.userA.address)
229229

230230
let tokensOfUserA = await sbt.tokensOfOwner(signers.userA.address)
231231
expect(tokensOfUserA.length).to.eq(1)
232-
expect(tokensOfUserA[0]).to.eq(0)
232+
expect(tokensOfUserA[0]).to.eq(1)
233233
expect(await sbt.totalSupply()).to.eq(1)
234234
expect(await sbt.currentIndex()).to.eq(1)
235-
expect(await sbt.ownerOf(0)).to.eq(signers.userA.address)
235+
expect(await sbt.ownerOf(1)).to.eq(signers.userA.address)
236236
expect(await sbt.balanceOf(signers.userA.address)).to.eq(1)
237-
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 0)).to.eq(0)
238-
expect(await sbt.tokenByIndex(0)).to.eq(0)
237+
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 0)).to.eq(1)
238+
expect(await sbt.tokenByIndex(0)).to.eq(1)
239239

240240
await expect(
241241
sbt.connect(signers.minterA).mint(signers.userB.address, metadata)
242242
)
243243
.to.emit(sbt, 'Minted')
244-
.withArgs(1, signers.userB.address)
244+
.withArgs(2, signers.userB.address)
245245

246246
// System checks
247247
expect(await sbt.totalSupply()).to.eq(2)
248248
expect(await sbt.currentIndex()).to.eq(2)
249249
// UserA checks
250250
tokensOfUserA = await sbt.tokensOfOwner(signers.userA.address)
251251
expect(tokensOfUserA.length).to.eq(1)
252-
expect(tokensOfUserA[0]).to.eq(0)
253-
expect(await sbt.ownerOf(0)).to.eq(signers.userA.address)
252+
expect(tokensOfUserA[0]).to.eq(1)
253+
expect(await sbt.ownerOf(1)).to.eq(signers.userA.address)
254254
expect(await sbt.balanceOf(signers.userA.address)).to.eq(1)
255-
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 0)).to.eq(0)
256-
expect(await sbt.tokenByIndex(0)).to.eq(0)
255+
expect(await sbt.tokenOfOwnerByIndex(signers.userA.address, 0)).to.eq(1)
256+
expect(await sbt.tokenByIndex(0)).to.eq(1)
257257
// UserB checks
258258
const tokensOfUserB = await sbt.tokensOfOwner(signers.userB.address)
259259
expect(tokensOfUserB.length).to.eq(1)
260-
expect(tokensOfUserB[0]).to.eq(1)
261-
expect(await sbt.ownerOf(1)).to.eq(signers.userB.address)
260+
expect(tokensOfUserB[0]).to.eq(2)
261+
expect(await sbt.ownerOf(2)).to.eq(signers.userB.address)
262262
expect(await sbt.balanceOf(signers.userB.address)).to.eq(1)
263-
expect(await sbt.tokenOfOwnerByIndex(signers.userB.address, 0)).to.eq(1)
264-
expect(await sbt.tokenByIndex(1)).to.eq(1)
263+
expect(await sbt.tokenOfOwnerByIndex(signers.userB.address, 0)).to.eq(2)
264+
expect(await sbt.tokenByIndex(1)).to.eq(2)
265265
})
266266
})
267267

0 commit comments

Comments
 (0)