Skip to content

Commit

Permalink
contracts: add e2e test to ensure signed queries are functioning (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
CedarMist committed Aug 28, 2023
1 parent 568a211 commit eb3de03
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
9 changes: 9 additions & 0 deletions contracts/contracts/tests/SignedQueriesTests.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.0;

contract SignedQueriesTests {
function testSignedQueries() external view returns (address) {
return msg.sender;
}
}
2 changes: 1 addition & 1 deletion contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//import '@oasisprotocol/sapphire-hardhat';
import '@oasisprotocol/sapphire-hardhat';
import { HardhatUserConfig, task } from 'hardhat/config';
import '@typechain/hardhat';
import '@nomicfoundation/hardhat-chai-matchers';
Expand Down
22 changes: 22 additions & 0 deletions contracts/test/signedqueries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { expect } from 'chai';
import { ethers } from 'hardhat';
import { SignedQueriesTests } from '../typechain-types/contracts/tests/SignedQueriesTests';
import { SignedQueriesTests__factory } from '../typechain-types/factories/contracts/tests';

describe('Signed Queries', () => {
let contract: SignedQueriesTests;

before(async () => {
const factory = (await ethers.getContractFactory(
'SignedQueriesTests',
)) as SignedQueriesTests__factory;
contract = await factory.deploy();
await contract.deployed();
});

it('msg.sender is signer', async () => {
const [owner] = await ethers.getSigners();
const who = await contract.testSignedQueries();
expect(who).eq(await owner.getAddress());
});
});

0 comments on commit eb3de03

Please sign in to comment.