@@ -31,18 +31,22 @@ describe('ERC721URIStorage', function () {
3131 } ) ;
3232
3333 it ( 'it is empty by default' , async function ( ) {
34- expect ( await this . token . tokenURI ( tokenId ) ) . to . equal ( '' ) ;
34+ await expect ( this . token . $_suffixURI ( tokenId ) ) . to . eventually . equal ( '' ) ;
35+ await expect ( this . token . tokenURI ( tokenId ) ) . to . eventually . equal ( '' ) ;
3536 } ) ;
3637
3738 it ( 'reverts when queried for non existent token id' , async function ( ) {
39+ await expect ( this . token . $_suffixURI ( tokenId ) ) . to . eventually . equal ( '' ) ;
3840 await expect ( this . token . tokenURI ( nonExistentTokenId ) )
3941 . to . be . revertedWithCustomError ( this . token , 'ERC721NonexistentToken' )
4042 . withArgs ( nonExistentTokenId ) ;
4143 } ) ;
4244
4345 it ( 'can be set for a token id' , async function ( ) {
4446 await this . token . $_setTokenURI ( tokenId , sampleUri ) ;
45- expect ( await this . token . tokenURI ( tokenId ) ) . to . equal ( sampleUri ) ;
47+
48+ await expect ( this . token . $_suffixURI ( tokenId ) ) . to . eventually . equal ( sampleUri ) ;
49+ await expect ( this . token . tokenURI ( tokenId ) ) . to . eventually . equal ( sampleUri ) ;
4650 } ) ;
4751
4852 it ( 'setting the uri emits an event' , async function ( ) {
@@ -58,38 +62,43 @@ describe('ERC721URIStorage', function () {
5862
5963 // value will be accessible after mint
6064 await this . token . $_mint ( this . owner , nonExistentTokenId ) ;
61- expect ( await this . token . tokenURI ( nonExistentTokenId ) ) . to . equal ( sampleUri ) ;
65+ await expect ( this . token . tokenURI ( nonExistentTokenId ) ) . to . eventually . equal ( sampleUri ) ;
6266 } ) ;
6367
6468 it ( 'base URI can be set' , async function ( ) {
6569 await this . token . setBaseURI ( baseURI ) ;
66- expect ( await this . token . $_baseURI ( ) ) . to . equal ( baseURI ) ;
70+ await expect ( this . token . $_baseURI ( ) ) . to . eventually . equal ( baseURI ) ;
6771 } ) ;
6872
6973 it ( 'base URI is added as a prefix to the token URI' , async function ( ) {
7074 await this . token . setBaseURI ( baseURI ) ;
7175 await this . token . $_setTokenURI ( tokenId , sampleUri ) ;
7276
73- expect ( await this . token . tokenURI ( tokenId ) ) . to . equal ( baseURI + sampleUri ) ;
77+ await expect ( this . token . $_suffixURI ( tokenId ) ) . to . eventually . equal ( sampleUri ) ;
78+ await expect ( this . token . tokenURI ( tokenId ) ) . to . eventually . equal ( baseURI + sampleUri ) ;
7479 } ) ;
7580
7681 it ( 'token URI can be changed by changing the base URI' , async function ( ) {
7782 await this . token . setBaseURI ( baseURI ) ;
7883 await this . token . $_setTokenURI ( tokenId , sampleUri ) ;
7984
8085 await this . token . setBaseURI ( otherBaseURI ) ;
81- expect ( await this . token . tokenURI ( tokenId ) ) . to . equal ( otherBaseURI + sampleUri ) ;
86+
87+ await expect ( this . token . $_suffixURI ( tokenId ) ) . to . eventually . equal ( sampleUri ) ;
88+ await expect ( this . token . tokenURI ( tokenId ) ) . to . eventually . equal ( otherBaseURI + sampleUri ) ;
8289 } ) ;
8390
8491 it ( 'tokenId is appended to base URI for tokens with no URI' , async function ( ) {
8592 await this . token . setBaseURI ( baseURI ) ;
8693
87- expect ( await this . token . tokenURI ( tokenId ) ) . to . equal ( baseURI + tokenId ) ;
94+ await expect ( this . token . $_suffixURI ( tokenId ) ) . to . eventually . equal ( '' ) ;
95+ await expect ( this . token . tokenURI ( tokenId ) ) . to . eventually . equal ( baseURI + tokenId ) ;
8896 } ) ;
8997
9098 it ( 'tokens without URI can be burnt ' , async function ( ) {
9199 await this . token . $_burn ( tokenId ) ;
92100
101+ await expect ( this . token . $_suffixURI ( tokenId ) ) . to . eventually . equal ( '' ) ;
93102 await expect ( this . token . tokenURI ( tokenId ) )
94103 . to . be . revertedWithCustomError ( this . token , 'ERC721NonexistentToken' )
95104 . withArgs ( tokenId ) ;
@@ -100,6 +109,7 @@ describe('ERC721URIStorage', function () {
100109
101110 await this . token . $_burn ( tokenId ) ;
102111
112+ await expect ( this . token . $_suffixURI ( tokenId ) ) . to . eventually . equal ( sampleUri ) ;
103113 await expect ( this . token . tokenURI ( tokenId ) )
104114 . to . be . revertedWithCustomError ( this . token , 'ERC721NonexistentToken' )
105115 . withArgs ( tokenId ) ;
@@ -110,12 +120,15 @@ describe('ERC721URIStorage', function () {
110120
111121 await this . token . $_burn ( tokenId ) ;
112122
123+ await expect ( this . token . $_suffixURI ( tokenId ) ) . to . eventually . equal ( sampleUri ) ;
113124 await expect ( this . token . tokenURI ( tokenId ) )
114125 . to . be . revertedWithCustomError ( this . token , 'ERC721NonexistentToken' )
115126 . withArgs ( tokenId ) ;
116127
117128 await this . token . $_mint ( this . owner , tokenId ) ;
118- expect ( await this . token . tokenURI ( tokenId ) ) . to . equal ( sampleUri ) ;
129+
130+ await expect ( this . token . $_suffixURI ( tokenId ) ) . to . eventually . equal ( sampleUri ) ;
131+ await expect ( this . token . tokenURI ( tokenId ) ) . to . eventually . equal ( sampleUri ) ;
119132 } ) ;
120133 } ) ;
121134} ) ;
0 commit comments