Skip to content

Commit da118d9

Browse files
Krishang NadgaudaKrishang Nadgauda
authored andcommitted
format reveal tests
1 parent bd06385 commit da118d9

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

src/test/drop/SignatureDrop.t.sol

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ contract SignatureDropTest is BaseTest {
4343
}
4444

4545
/*///////////////////////////////////////////////////////////////
46-
Lazy Mint Tests
46+
Lazy Mint Tests
4747
//////////////////////////////////////////////////////////////*/
4848

4949
/*
@@ -210,13 +210,42 @@ contract SignatureDropTest is BaseTest {
210210
}
211211

212212
/*///////////////////////////////////////////////////////////////
213-
Delayed Reveal Tests
213+
Delayed Reveal Tests
214214
//////////////////////////////////////////////////////////////*/
215215

216+
/*
217+
* note: Testing state changes; URI revealed for a batch of tokens.
218+
*/
219+
function test_state_reveal() public {
220+
vm.startPrank(deployerSigner);
221+
222+
bytes memory key = "key";
223+
uint256 amountToLazyMint = 100;
224+
bytes memory secretURI = "ipfs://";
225+
string memory placeholderURI = "ipfs://";
226+
bytes memory encryptedURI = sigdrop.encryptDecrypt(secretURI, key);
227+
sigdrop.lazyMint(amountToLazyMint, placeholderURI, encryptedURI);
228+
229+
for(uint256 i = 0; i < amountToLazyMint; i += 1) {
230+
string memory uri = sigdrop.tokenURI(i);
231+
assertEq(uri, string(abi.encodePacked(placeholderURI, "0")));
232+
}
233+
234+
string memory revealedURI = sigdrop.reveal(0, key);
235+
assertEq(revealedURI, string(secretURI));
236+
237+
for(uint256 i = 0; i < amountToLazyMint; i += 1) {
238+
string memory uri = sigdrop.tokenURI(i);
239+
assertEq(uri, string(abi.encodePacked(secretURI, i.toString())));
240+
}
241+
242+
vm.stopPrank();
243+
}
244+
216245
/**
217246
* note: Testing revert condition; an address without MINTER_ROLE calls reveal function.
218247
*/
219-
function test_revert_delayedReveal_minterRole() public {
248+
function test_revert_reveal_MINTER_ROLE() public {
220249
bytes memory encryptedURI = sigdrop.encryptDecrypt("ipfs://", "key");
221250
vm.prank(deployerSigner);
222251
sigdrop.lazyMint(100, "", encryptedURI);
@@ -238,39 +267,26 @@ contract SignatureDropTest is BaseTest {
238267
/*
239268
* note: Testing revert condition; trying to reveal URI for non-existent batch.
240269
*/
241-
function test_revert_delayedReveal_getBatchIdAtIndex() public {
270+
function test_revert_reveal_revealingNonExistentBatch() public {
242271
vm.startPrank(deployerSigner);
243272

244273
bytes memory encryptedURI = sigdrop.encryptDecrypt("ipfs://", "key");
245274
sigdrop.lazyMint(100, "", encryptedURI);
246275
sigdrop.reveal(0, "key");
247276

277+
console.log(sigdrop.getBaseURICount());
278+
248279
sigdrop.lazyMint(100, "", encryptedURI);
249280
vm.expectRevert("invalid index.");
250281
sigdrop.reveal(2, "key");
251282

252283
vm.stopPrank();
253284
}
254285

255-
/*
256-
* note: Testing state changes; URI revealed for a batch of tokens.
257-
*/
258-
function test_state_delayedReveal_getRevealURI() public {
259-
vm.startPrank(deployerSigner);
260-
261-
bytes memory encryptedURI = sigdrop.encryptDecrypt("ipfs://", "key");
262-
sigdrop.lazyMint(100, "", encryptedURI);
263-
264-
string memory revealedURI = sigdrop.reveal(0, "key");
265-
assertEq(revealedURI, "ipfs://");
266-
267-
vm.stopPrank();
268-
}
269-
270286
/*
271287
* note: Testing state changes; revealing URI with an incorrect key.
272288
*/
273-
function testFail_delayedReveal_incorrectKey() public {
289+
function testFail_reveal_incorrectKey() public {
274290
vm.startPrank(deployerSigner);
275291

276292
bytes memory encryptedURI = sigdrop.encryptDecrypt("ipfs://", "key");
@@ -282,26 +298,10 @@ contract SignatureDropTest is BaseTest {
282298
vm.stopPrank();
283299
}
284300

285-
/*
286-
* note: Testing state changes; check baseURI after reveal for a batch of tokens.
287-
*/
288-
function test_state_delayedReveal_setBaseURI() public {
289-
vm.startPrank(deployerSigner);
290-
291-
bytes memory encryptedURI = sigdrop.encryptDecrypt("ipfs://", "key");
292-
sigdrop.lazyMint(100, "", encryptedURI);
293-
sigdrop.reveal(0, "key");
294-
295-
string memory uri = sigdrop.tokenURI(1);
296-
assertEq(uri, "ipfs://1");
297-
298-
vm.stopPrank();
299-
}
300-
301301
/**
302-
* note: Testing event emission; token URI revealed.
302+
* note: Testing event emission; TokenURIRevealed.
303303
*/
304-
function test_event_delayedReveal_event() public {
304+
function test_event_reveal_TokenURIRevealed() public {
305305
vm.startPrank(deployerSigner);
306306

307307
bytes memory encryptedURI = sigdrop.encryptDecrypt("ipfs://", "key");
@@ -315,7 +315,7 @@ contract SignatureDropTest is BaseTest {
315315
}
316316

317317
/*///////////////////////////////////////////////////////////////
318-
Signature Mint Tests
318+
Signature Mint Tests
319319
//////////////////////////////////////////////////////////////*/
320320

321321
/**

0 commit comments

Comments
 (0)