Skip to content

Commit

Permalink
test(registry): WitOracleRadonRegistry.verifyRadonRetriteval(bytes32,…
Browse files Browse the repository at this point in the history
…string)
  • Loading branch information
guidiaz committed Oct 4, 2024
1 parent 9248f0b commit d2a0af9
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions test/witOracleRadonRegistry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ contract("WitOracleRadonRegistry", (accounts) => {

let rngSourceHash
let binanceTickerHash
let binanceUsdTickerHash
let uniswapToken1PriceHash
let heavyRetrievalHash

let rngHash

Expand Down Expand Up @@ -130,7 +130,7 @@ contract("WitOracleRadonRegistry", (accounts) => {
assert.equal(tx.logs.length, 0, "some unexpected event was emitted")
})
it("generates proper hash upon offchain verification of already existing randmoness source", async () => {
const hash = await radonRegistry.verifyRadonRetrieval.call(
const hash = await radonRegistry.methods["verifyRadonRetrieval(uint8,string,string,string[2][],bytes)"].call(
2, // requestMethod
"", // requestURL
"", // requestBody
Expand Down Expand Up @@ -185,6 +185,27 @@ contract("WitOracleRadonRegistry", (accounts) => {
"NewRadonRetrieval"
)
})
it("fork existing retrieval by settling one out of two parameters", async () => {
const tx = await radonRegistry.verifyRadonRetrieval(
binanceTickerHash,
"USD"
)
assert.equal(tx.logs.length, 1)
expectEvent(
tx.receipt,
"NewRadonRetrieval"
)
binanceUsdTickerHash = tx.logs[0].args.hash
})
it("metadata of forked retrieval gets stored as expected", async () => {
const ds = await radonRegistry.lookupRadonRetrieval.call(binanceUsdTickerHash)
assert.equal(ds.method, 1) // HTTP-GET
assert.equal(ds.dataType, 4) // Integer
assert.equal(ds.url, "https://api.binance.us/api/v3/ticker/price?symbol=\\0\\USD")
assert.equal(ds.body, "")
assert(ds.headers.length === 0)
assert.equal(ds.radonScript, "0x841877821864696c61737450726963658218571a000f4240185b")
})
})
context("Witnet.RadonRetrievalMethods.HttpPost", async () => {
it(
Expand Down

0 comments on commit d2a0af9

Please sign in to comment.