Skip to content

Commit

Permalink
Fixing comments
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Stefanov <[email protected]>
  • Loading branch information
stefan-stefanooov committed Nov 7, 2023
1 parent e445d19 commit 844cc94
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions test/solidity/simple-auction/simple-auction.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*-
*
* Hedera Smart Contracts
*
* Copyright (C) 2023 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
const { expect } = require('chai')
const { ethers } = require('hardhat')
const Constants = require('../../constants')
Expand Down Expand Up @@ -48,30 +67,16 @@ describe('Solidity Simple Auction example', function () {
})

it('should confirm bid not high enough scenario works: BidNotHighEnough', async function () {
try {
const tr = await contract.bid({ value: bidAmountSmall })
const receipt = await tr.wait();
expect(receipt).to.not.be.null
} catch (error) {
hasError = true
expect(error.code).to.be.equal('CALL_EXCEPTION')
}

expect(hasError).to.equal(true)
const tr = await contract.bid({ value: bidAmountSmall })
await expect(tr.wait()).to.eventually.be.rejected.and.have.property('code', 'CALL_EXCEPTION')
})

it('should revert a bid with "AuctionAlreadyEnded" error', async function () {
try {
console.log("Waiting for the next block")
await sleep(5000)
console.log("Done")
const tr = await contractShortLived.bid({ value: bidAmountSmall })
await tr.wait()
} catch (error) {
hasError = true
}

expect(hasError).to.equal(true)
console.log("Waiting for the next block")
await sleep(5000)
console.log("Done")
const tr = await contractShortLived.bid({ value: bidAmountSmall })
await expect(tr.wait()).to.eventually.be.rejected
})

it('should confirm "withdraw" function works', async function () {
Expand Down

0 comments on commit 844cc94

Please sign in to comment.