-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0464d30
commit bbf4b1e
Showing
3 changed files
with
54 additions
and
7 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
41 changes: 41 additions & 0 deletions
41
examples/bri-3/src/bri/ccsm/services/ethereum.service.spec.ts
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,41 @@ | ||
import { EthereumService } from './ethereum.service'; | ||
|
||
jest.setTimeout(60000); | ||
describe('Ethereum services', () => { | ||
let ccsm: EthereumService; | ||
|
||
beforeAll(async () => { | ||
ccsm = new EthereumService(); | ||
await ccsm.deployContract(); | ||
}); | ||
|
||
describe('storeAnchorHash', () => { | ||
it('should set anchor hash in the mapping', async () => { | ||
//Arrange | ||
const workgroupdId = '123'; | ||
const anchorHash = 'anchorHash'; | ||
|
||
//Act | ||
await ccsm.storeAnchorHash(workgroupdId, anchorHash); | ||
const ccsmContract = await ccsm.connectToContract({ readonly: true }); | ||
|
||
//Assert | ||
expect(await ccsmContract.AnchorHashStore('workgroupId')).toEqual( | ||
anchorHash, | ||
); | ||
}); | ||
}); | ||
describe('getAnchorHash', () => { | ||
it('should get anchor hash of the workgroupId from the mapping', async () => { | ||
//Arrange | ||
const workgroupdId = '123'; | ||
const anchorHash = 'anchorHash'; | ||
|
||
//Act | ||
const response = await ccsm.getAnchorHash(workgroupdId); | ||
|
||
//Assert | ||
expect(response).toEqual(anchorHash); | ||
}); | ||
}); | ||
}); |
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