forked from dautonomous/truffle-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PriceConsumerV3_test.js
30 lines (24 loc) · 982 Bytes
/
PriceConsumerV3_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* eslint-disable @typescript-eslint/no-var-requires
This repo is for testing on kovan network only.
You can get truffle teams and do a forking version of
these tests.
*/
const { assert } = require('chai')
contract('PriceConsumerV3', accounts => {
const MockPriceFeed = artifacts.require('MockV3Aggregator')
const PriceConsumerV3 = artifacts.require('PriceConsumerV3')
const defaultAccount = accounts[0]
// The addresses here can be found in the chainlink docs
// https://docs.chain.link/docs/ethereum-addresses
let priceConsumerV3, mockPriceFeed
describe('#getLatestPrice', () => {
let price = "2000000000000000000"
beforeEach(async () => {
mockPriceFeed = await MockPriceFeed.new(8, price)
priceConsumerV3 = await PriceConsumerV3.new(mockPriceFeed.address)
})
it('returns a price', async () => {
assert.equal(await priceConsumerV3.getLatestPrice(), price)
})
})
})