Skip to content

Commit

Permalink
fix(testing): add ids mirage filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelinz committed Jun 21, 2024
1 parent 9c370c7 commit 2bdaa19
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/testing/addon/mirage-graphql/filters/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,16 @@ export default class BaseFilter {
btoa(`${this.type}:${slug}`) === value,
);
}

ids(records, value) {
if (value === undefined || value === null) {
return [];
}

return records.filter(({ id, slug }) =>
[id, slug, btoa(`${this.type}:${id}`), btoa(`${this.type}:${slug}`)].some(
(v) => value.includes(v),
),
);
}
}

0 comments on commit 2bdaa19

Please sign in to comment.