Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non regression test #30

Merged
merged 3 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,10 @@ jobs:
- name: Start hedera-sourcify server
run: (npm run server:start&)

- name: Start test
- name: Wait for hedera-sourcify server
uses: iFaxity/wait-on-action@v1
with:
resource: http://127.0.0.1:5000/chains

- name: Start tests
run: npm run test:hedera
90 changes: 90 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"serve-index": "^1.9.1",
"solc": "^0.8.17",
"swagger-ui-express": "^4.6.3",
"wait-on": "^7.0.1",
"winston": "^3.8.2",
"winston-loki": "^6.0.6",
"yamljs": "^0.3.0"
Expand Down
11 changes: 6 additions & 5 deletions test/test-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ describe('Basic non-regression of hedera-sourcify server', function () {

it('Should return correct verification status for newly created contract', async function () {

// console.log(`Contacting server at URL: ${SERVER_URL}`)
let health = await axios.get(`${SERVER_URL}/health`)
console.log(`health: ${JSON.stringify(health.data)}`)
// console.log(`Server health: ${JSON.stringify(health.data)}`)
svienot marked this conversation as resolved.
Show resolved Hide resolved

// Grab Hedera network, account ID and private key from .env file
const network = process.env.HEDERA_NETWORK ?? 'local'
Expand All @@ -39,13 +40,13 @@ describe('Basic non-regression of hedera-sourcify server', function () {
"HelloHedera.sol"
);
const contractAddress = contractId.toSolidityAddress()
console.log("Deployed contract Address is " + contractAddress);
// console.log("Deployed contract Address is " + contractAddress);

// Make call to Sourcify to check that contract is not verified
const checkUrl = `${SERVER_URL}/check-by-addresses?addresses=${contractAddress}&chainIds=${chainId}`

let response = await axios.get(checkUrl)
console.log(`verification status for contract ${response.data[0].address} is: ${response.data[0].status}`);
// console.log(`Verification status for contract ${response.data[0].address} is: ${response.data[0].status}`);
expect(response.data[0].status).to.equal('false');


Expand All @@ -63,12 +64,12 @@ describe('Basic non-regression of hedera-sourcify server', function () {
}

response = await axios.post(`${SERVER_URL}/verify`, verificationData)
console.log(`verification response: ${JSON.stringify(response.data)}`);
// console.log(`Verification response: ${JSON.stringify(response.data)}`);
expect(response.data.result[0].status).to.equal('perfect');

// Make call to Sourcify to check that contract is now verified
response = await axios.get(checkUrl)
console.log(`verification status for contract ${response.data[0].address} is: ${response.data[0].status}`);
// console.log(`Verification status for contract ${response.data[0].address} is: ${response.data[0].status}`);
expect(response.data[0].status).to.equal('perfect');

return Promise.resolve();
Expand Down
Loading