Open Peeja opened 1 year ago
test('constructs a nested object with a variable @id', async () => { await api.write<Subject>({ '@id': 'fred', name: 'Fred', wife: { '@id': 'wilma' } }); await expect(api.read<Construct>({ '@construct': { '@id': 'fred', wife: { '@id': '?' } } })).resolves.toMatchObject([{ '@id': 'fred', wife: { '@id': 'wilma' } }]); });
Instead, we get [{ '@id': 'fred', wife: { '@id': '?' } }]—the variable has shown up as a value in the result.
[{ '@id': 'fred', wife: { '@id': '?' } }]
Note that using the variable as the entire value of wife in the @construct works correctly:
wife
@construct
{ '@construct': { '@id': 'fred', wife: '?' } } => [{ '@id': 'fred', wife: { '@id': 'wilma' } }]
{ '@construct': { '@id': 'fred', wife: '?' } }
[{ '@id': 'fred', wife: { '@id': 'wilma' } }]
Instead, we get
[{ '@id': 'fred', wife: { '@id': '?' } }]
—the variable has shown up as a value in the result.Note that using the variable as the entire value of
wife
in the@construct
works correctly:{ '@construct': { '@id': 'fred', wife: '?' } }
=>[{ '@id': 'fred', wife: { '@id': 'wilma' } }]