Closed mikecann closed 4 years ago
I recommend you to use code like this to ensure ids are not randomly generated when doing tests:
import { setGlobalConfig } from "../src"
let id = 1
setGlobalConfig({
modelIdGenerator() {
return `id-${id++}`
},
})
beforeEach(() => {
id = 1
})
Ah yes, I totally forgot about the global config! Thanks ill use that!
Hi,
Im trying to use Jest Snapshots for testing but when I use a rootReference I keep getting invalid snapshots because the modelId of the rootRef changes despite me explicitly setting the modelId to something.
Example:
Note that the $modelId for the child's parent ref is
0-w6DCozt8wrXDrUbCqsKewrHDicK5a8KOw48l
despite me explictly setting the parents $modelId toaaa
..When running JEST I get the warning:
Does that have anything to do with it?