diff --git a/test/extensions/ERC721ASpot.test.js b/test/extensions/ERC721ASpot.test.js index acde1b27..f9be7ca2 100644 --- a/test/extensions/ERC721ASpot.test.js +++ b/test/extensions/ERC721ASpot.test.js @@ -165,11 +165,8 @@ describe('ERC721ASpot', function () { }); context('with transfers', function () { - beforeEach(async function () { - await this.erc721aSpot.safeMint(this.addr1.address, 5); - }); - it('reverts if token is not minted', async function () { + await this.erc721aSpot.safeMint(this.addr1.address, 10); await expect(this.erc721aSpot .connect(this.addr1) .transferFrom(this.addr1.address, this.owner.address, 21)).to.be.revertedWith( @@ -180,6 +177,32 @@ describe('ERC721ASpot', function () { .connect(this.addr1) .transferFrom(this.addr1.address, this.owner.address, 21); }); + + it('edge case 1', async function () { + await this.erc721aSpot.safeMintSpot(this.addr1.address, 20); + await this.erc721aSpot.safeMint(this.addr1.address, 10); + await this.erc721aSpot.connect(this.addr1).transferFrom(this.addr1.address, this.owner.address, 20); + expect(await this.erc721aSpot.ownerOf(20)).to.eq(this.owner.address); + expect(await this.erc721aSpot.ownerOf(19)).to.eq(this.addr1.address); + expect(await this.erc721aSpot.ownerOf(18)).to.eq(this.addr1.address); + await this.erc721aSpot.connect(this.addr1).transferFrom(this.addr1.address, this.owner.address, 19); + expect(await this.erc721aSpot.ownerOf(20)).to.eq(this.owner.address); + expect(await this.erc721aSpot.ownerOf(19)).to.eq(this.owner.address); + expect(await this.erc721aSpot.ownerOf(18)).to.eq(this.addr1.address); + }); + + it('edge case 2', async function () { + await this.erc721aSpot.safeMintSpot(this.addr1.address, 20); + await this.erc721aSpot.safeMint(this.addr1.address, 10); + await this.erc721aSpot.connect(this.addr1).transferFrom(this.addr1.address, this.owner.address, 19); + expect(await this.erc721aSpot.ownerOf(20)).to.eq(this.addr1.address); + expect(await this.erc721aSpot.ownerOf(19)).to.eq(this.owner.address); + expect(await this.erc721aSpot.ownerOf(18)).to.eq(this.addr1.address); + await this.erc721aSpot.connect(this.addr1).transferFrom(this.addr1.address, this.owner.address, 20); + expect(await this.erc721aSpot.ownerOf(20)).to.eq(this.owner.address); + expect(await this.erc721aSpot.ownerOf(19)).to.eq(this.owner.address); + expect(await this.erc721aSpot.ownerOf(18)).to.eq(this.addr1.address); + }); }); context('with burns', function () {