Maybe defend against undefined participations[test.id] ?
`variantId = (participations[test.id] || {}).variant;`