Checks if the data from two squid instances are the same.
Important
You need Deno installed.
- Load original data to KV store:
Important
you JSON entities must contain id
field.
Note
Code expects file named load.json
deno task load
- Write a sampler function to unify the data
Note
Tou can find these lines in main.ts
file L#10-11
const sampleFn = sampleSample
type Sample = ReturnType<typeof sampleFn>
// Sample function
function sampleSample(item: any) {
return {
id: item.id,
name: item.name,
// note that fields needs to be in the item
nft_count: item.nft_count,
count: item.count,
equal: item.equal
}
}
- Check if data is the same
Note
Code expects file names test.json
deno task start
- Understading the output
Note
[Diff] Actual / Expected
- Green data (Expected) are from
load.json
- Red data (Actual) are from
test.json
{
count: 9,
- equal: true,
+ equal: false,
id: "0xb67bedc5e80a7913b92da0a56fc8aba6c1273a6a",
name: "strigae",
- nft_count: 9,
+ nft_count: 7,
}