Skip to content

Commit

Permalink
add test to fix nested query
Browse files Browse the repository at this point in the history
  • Loading branch information
tintinthong committed Nov 4, 2024
1 parent a398617 commit a3ea344
Showing 1 changed file with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,70 @@ module(`Integration | prerendered-card-search`, function (hooks) {
.dom('.card-container:nth-child(1)')
.containsText('Cardy Stackington Jr. III');
});

test<TestContextWithSSE>(`can parse objects in nested array`, async function (assert) {
let query: Query = {
filter: {
on: {
module: `${testRealmURL}book`,
name: 'Book',
},
every: [
{
eq: {
'author.firstName': 'Cardy',
},
},
{
any: [
{
eq: {
'author.lastName': 'Jones',
},
},
{
eq: {
'author.lastName': 'Stackington Jr. III',
},
},
],
},
],
},
sort: [
{
by: 'author.lastName',
on: { module: `${testRealmURL}book`, name: 'Book' },
},
],
};
let realms = [testRealmURL];
await render(<template>
<PrerenderedCardSearch
@query={{query}}
@format='fitted'
@realms={{realms}}
>
<:loading>
Loading...
</:loading>
<:response as |cards|>
{{#each cards as |card|}}
<div class='card-container'>
<card.component />
</div>
{{/each}}
</:response>
</PrerenderedCardSearch>

{{! to support incremental indexing }}
<CardPrerender />
</template>);
await waitFor('.card-container');
assert.dom('.card-container').exists({ count: 2 });
assert
.dom('.card-container:nth-child(2)')
.containsText('Cardy Stackington Jr. III');
assert.dom('.card-container:nth-child(1)').containsText('Cardy Jones');
});
});

0 comments on commit a3ea344

Please sign in to comment.