-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* test: added new test suite for PrngSystemContract Signed-off-by: Logan Nguyen <[email protected]> * test: added PrngSystemContract to CI tasks Signed-off-by: Logan Nguyen <[email protected]> * update(test): checked PseudoRandomSeed against HashZero Signed-off-by: Logan Nguyen <[email protected]> * update: added expect(result).to.exist Signed-off-by: Logan Nguyen <[email protected]> --------- Signed-off-by: Logan Nguyen <[email protected]>
- Loading branch information
1 parent
77e6ade
commit 66ffc3a
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/*- | ||
* | ||
* 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') | ||
|
||
describe('PrngSystemContract tests', function () { | ||
let prngSystemContract | ||
|
||
before(async function () { | ||
const factory = await ethers.getContractFactory( | ||
Constants.Contract.PrngSystemContract | ||
) | ||
|
||
prngSystemContract = await factory.deploy() | ||
}) | ||
|
||
it('should be able to execute getPseudorandomSeed to generate a pseudo random seed', async function () { | ||
const tx = await prngSystemContract.getPseudorandomSeed() | ||
const txReceipt = await tx.wait() | ||
|
||
const result = txReceipt.events.filter( | ||
(e) => e.event === Constants.Events.PseudoRandomSeed | ||
)[0].args[0] | ||
|
||
expect(result).to.exist | ||
expect(result).to.not.hexEqual(ethers.constants.HashZero) | ||
}) | ||
}) |