|
| 1 | +import { |
| 2 | + setupTokenGatedTest, |
| 3 | + testTokenWhitelistManagement, |
| 4 | + testAccessControl, |
| 5 | + testUnsupportedTokenErrors, |
| 6 | + testERC20Gating, |
| 7 | + testERC721Gating, |
| 8 | + testERC1155Gating, |
| 9 | + testWhitelistIntegration, |
| 10 | + TokenGatedTestContext, |
| 11 | +} from "./helpers/dispute-kit-gated-common"; |
| 12 | +import { |
| 13 | + setupShutterTest, |
| 14 | + testCommitPhase, |
| 15 | + testNormalFlowBotReveals, |
| 16 | + testRecoveryFlowJurorReveals, |
| 17 | + testHashFunctionBehavior, |
| 18 | + testEdgeCasesAndSecurity, |
| 19 | + ShutterTestContext, |
| 20 | +} from "./helpers/dispute-kit-shutter-common"; |
| 21 | + |
| 22 | +/* eslint-disable no-unused-vars */ |
| 23 | +/* eslint-disable no-unused-expressions */ |
| 24 | + |
| 25 | +/** |
| 26 | + * Test suite for DisputeKitGatedShutter - a dispute kit that requires jurors to hold |
| 27 | + * specific tokens (ERC20, ERC721, or ERC1155) to participate in disputes, with additional |
| 28 | + * Shutter functionality for commit-reveal voting. |
| 29 | + * |
| 30 | + * Tests cover: |
| 31 | + * - All DisputeKitGated functionality (via shared tests) |
| 32 | + * - Shutter-specific commit/reveal mechanism |
| 33 | + * - Recovery commits for juror vote recovery |
| 34 | + * - Integration between token gating and Shutter features |
| 35 | + */ |
| 36 | +describe("DisputeKitGatedShutter", async () => { |
| 37 | + describe("Token Gating Features", async () => { |
| 38 | + let tokenContext: TokenGatedTestContext; |
| 39 | + |
| 40 | + beforeEach("Setup", async () => { |
| 41 | + tokenContext = await setupTokenGatedTest({ contractName: "DisputeKitGatedShutterMock" }); |
| 42 | + }); |
| 43 | + |
| 44 | + // Run all shared token gating tests |
| 45 | + testTokenWhitelistManagement(() => tokenContext); |
| 46 | + testAccessControl(() => tokenContext); |
| 47 | + testUnsupportedTokenErrors(() => tokenContext); |
| 48 | + testERC20Gating(() => tokenContext); |
| 49 | + testERC721Gating(() => tokenContext); |
| 50 | + testERC1155Gating(() => tokenContext); |
| 51 | + testWhitelistIntegration(() => tokenContext); |
| 52 | + }); |
| 53 | + |
| 54 | + describe("Shutter Features", async () => { |
| 55 | + let shutterContext: ShutterTestContext; |
| 56 | + |
| 57 | + beforeEach("Setup", async () => { |
| 58 | + // Setup DisputeKitGatedShutter with token gating enabled |
| 59 | + shutterContext = await setupShutterTest({ |
| 60 | + contractName: "DisputeKitGatedShutter", |
| 61 | + isGated: true, // Enable token gating for DAI |
| 62 | + }); |
| 63 | + }); |
| 64 | + |
| 65 | + // Run all shared Shutter tests |
| 66 | + testCommitPhase(() => shutterContext); |
| 67 | + testNormalFlowBotReveals(() => shutterContext); |
| 68 | + testRecoveryFlowJurorReveals(() => shutterContext); |
| 69 | + testHashFunctionBehavior(() => shutterContext); |
| 70 | + testEdgeCasesAndSecurity(() => shutterContext); |
| 71 | + }); |
| 72 | +}); |
0 commit comments