Skip to content

Commit

Permalink
Update packages/spacecat-shared-data-access/test/unit/v2/models/audit…
Browse files Browse the repository at this point in the history
…/audit.collection.test.js

Co-authored-by: Damian Zehnder <16799758+dzehnder@users.noreply.github.com>
  • Loading branch information
solaris007 and dzehnder authored Dec 23, 2024
1 parent b8577f9 commit bfa4ef0
Showing 1 changed file with 0 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,6 @@ describe('AuditCollection', () => {
});

describe('onCreate', () => {

Check failure on line 63 in packages/spacecat-shared-data-access/test/unit/v2/models/audit/audit.collection.test.js

View workflow job for this annotation

GitHub Actions / Test

Block must not be padded by blank lines
/*
// create a copy of the audit as a LatestAudit entity
async _onCreate(item) {
const collection = this.entityRegistry.getCollection('LatestAuditCollection');
await collection.create(item.toJSON());
}
// of the created audits, find the latest per site and auditType
// and create a LatestAudit copy for each
async _onCreateMany(items) {
const collection = this.entityRegistry.getCollection('LatestAuditCollection');
const latestAudits = items.createdItems.reduce((acc, audit) => {
const siteId = audit.getSiteId();
const auditType = audit.getAuditType();
const auditedAt = audit.getAuditedAt();
const key = `${siteId}-${auditType}`;
if (!acc[key] || acc[key].getAuditedAt() < auditedAt) {
acc[key] = audit;
}
return acc;
}, {});
await collection.createMany(Object.values(latestAudits).map((audit) => audit.toJSON()));
}
create tests for the above methods
*/

it('creates a LatestAudit entity', async () => {
const collection = {
Expand Down

0 comments on commit bfa4ef0

Please sign in to comment.