Skip to content

Commit

Permalink
fix: allByIndexKeys query
Browse files Browse the repository at this point in the history
  • Loading branch information
alinarublea committed Jan 6, 2025
1 parent 9af0966 commit 13e221e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ class BaseCollection {
* is not found.
* @async
*/
async allByIndexKeys(keys, options = {}) {
async allByIndexKeys(indexKeys, options = {}) {
const keys = { pk: entityNameToAllPKValue(this.entityName), ...indexKeys };
return this.#queryByIndexKeys(keys, options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ describe('LatestAudit IT', async () => {
});
});

it('gets all latest audits of a type', async () => {
const audits = await LatestAudit.allByAuditType('cwv');

expect(audits).to.be.an('array');
expect(audits.length).to.equal(9);
audits.forEach((audit) => {
expect(audit.getAuditType()).to.equal('cwv');
checkAudit(audit);
});
});

it('gets latest audits of type for a site', async () => {
const auditType = 'lhs-mobile';
const site = sampleData.sites[1];
Expand Down

0 comments on commit 13e221e

Please sign in to comment.