LimeChain / matchstick

🔥 Unit testing framework for Subgraph development on The Graph protocol. ⚙️
MIT License
207 stars 17 forks source link

Availability to get Data source information #425

Open clauBv23 opened 5 months ago

clauBv23 commented 5 months ago

Hi,

After the 0.6.0 version we can print the data sources with logDataSources. I would like to be able to retrieve the data source information to test whether the values are correct.

example:

let's say I have this logDataSource output:

🛠  {
  "0xa16081f360e3847006db660bae1c6d1b2e17ec2a": {
    "kind": "ethereum/contract",
    "name": "GraphTokenLockWallet",
    "address": "0xa16081f360e3847006db660bae1c6d1b2e17ec2a",
    "context": {
      "contextVal": {
        "type": "Int",
        "data": 325
      }
    }
  }
}

I would like to add a test that checks if the context is correct. Something like:


logDataSources('GraphTokenLockWallet')
let dataSource = getDataSource('GraphTokenLockWallet') 
assert.bigIntEquals(dataSource[0xa16081f360e3847006db660bae1c6d1b2e17ec2a].context.contextVal.data, 325)
// other assert for checking the data source context etc.