Skip to content

Commit

Permalink
Add web instantiate fixture to web tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smiasojed committed Jan 30, 2025
1 parent 5ec10f2 commit 6bb1a53
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions js/e2e/web.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,22 @@ test('should return not found error for missing imports in browser', async ({pag
expect(output.errors[0]).toHaveProperty('message');
expect(output.errors[0].message).toContain('Source "nonexistent/console.sol" not found');
});

test('should successfully compile a valid Solidity contract that instantiates another contract in browser', async ({ page }) => {
await page.goto("http://127.0.0.1:8080");
await page.setContent("");
const standardInput = loadFixture('instantiate.json')
const result = await runWorker(page, standardInput);

expect(typeof result).toBe('string');
let output = JSON.parse(result);
expect(output).toHaveProperty('contracts');
expect(output.contracts['fixtures/instantiate.sol']).toHaveProperty('ChildContract');
expect(output.contracts['fixtures/instantiate.sol'].ChildContract).toHaveProperty('abi');
expect(output.contracts['fixtures/instantiate.sol'].ChildContract).toHaveProperty('evm');
expect(output.contracts['fixtures/instantiate.sol'].ChildContract.evm).toHaveProperty('bytecode');
expect(output.contracts['fixtures/instantiate.sol']).toHaveProperty('MainContract');
expect(output.contracts['fixtures/instantiate.sol'].MainContract).toHaveProperty('abi');
expect(output.contracts['fixtures/instantiate.sol'].MainContract).toHaveProperty('evm');
expect(output.contracts['fixtures/instantiate.sol'].MainContract.evm).toHaveProperty('bytecode');
});

0 comments on commit 6bb1a53

Please sign in to comment.