Skip to content

Commit

Permalink
feat: remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
alinarublea committed Jun 20, 2024
1 parent da5122d commit 4b8a5a2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 148 deletions.
147 changes: 0 additions & 147 deletions packages/spacecat-shared-utils/test/helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@
/* eslint-env mocha */

import { expect } from 'chai';
import { createSite } from '@adobe/spacecat-shared-data-access/src/models/site.js';
import { createOrganization } from '@adobe/spacecat-shared-data-access/src/models/organization.js';
import { AUDIT_TYPE_BROKEN_BACKLINKS } from '@adobe/spacecat-shared-data-access/src/models/audit.js';

import {
generateCSVFile,
isAuditsDisabled,
resolveSecretsName,
resolveCustomerSecretsName,
} from '../src/helpers.js';
Expand Down Expand Up @@ -88,149 +84,6 @@ describe('resolveCustomerSecretsName', () => {
});
});

describe('isAuditsDisabled', () => {
it('audits are not disabled if no audit configs', () => {
const site = createSite({
id: 'site-1',
baseURL: 'http://site-1.com',
organizationId: 'org-1',
});

const org = createOrganization({
id: 'org-1',
name: 'some-org',
});

expect(isAuditsDisabled(site, org)).to.be.false;
});

it('audits are not disabled if no audit config for audit type', () => {
const site = createSite({
id: 'site-1',
baseURL: 'http://site-1.com',
organizationId: 'org-1',
});

const org = createOrganization({
id: 'org-1',
name: 'some-org',
});

const auditType = 'some-audit-type';

expect(isAuditsDisabled(site, org, auditType)).to.be.false;
});

it('audits are disabled if all audits disabled at org level', () => {
const site = createSite({
id: 'site-1',
baseURL: 'http://site-1.com',
organizationId: 'org-1',
});

const org = createOrganization({
id: 'org-1',
name: 'some-org',
config: {
audits: {
auditsDisabled: true,
},
},
});

const auditType = 'some-audit-type';

expect(isAuditsDisabled(site, org, auditType)).to.be.true;
});

it('audits are disabled if all audits disabled at site level', () => {
const site = createSite({
id: 'site-1',
baseURL: 'http://site-1.com',
organizationId: 'org-1',
auditConfig: {
auditsDisabled: true,
},
});

const org = createOrganization({
id: 'org-1',
name: 'some-org',
});

const auditType = 'some-audit-type';

expect(isAuditsDisabled(site, org, auditType)).to.be.true;
});

it('audits are disabled if all the audit type disabled at org level', () => {
const auditType = 'some-audit-type';

const site = createSite({
id: 'site-1',
baseURL: 'http://site-1.com',
organizationId: 'org-1',
});

const org = createOrganization({
id: 'org-1',
name: 'some-org',
config: {
audits: {
auditsDisabled: false,
auditTypeConfigs: {
[auditType]: {
disabled: true,
},
},
},
},
});

expect(isAuditsDisabled(site, org, auditType)).to.be.true;
});

it('audits are disabled if all the audit type disabled at site level', () => {
const auditType = 'some-audit-type';

const site = createSite({
id: 'site-1',
baseURL: 'http://site-1.com',
organizationId: 'org-1',
auditConfig: {
auditsDisabled: false,
auditTypeConfigs: {
[auditType]: {
disabled: true,
},
},
},
});

const org = createOrganization({
id: 'org-1',
name: 'some-org',
});

expect(isAuditsDisabled(site, org, auditType)).to.be.true;
});

it('audits are disabled if the audit type is disabled by default', () => {
const site = createSite({
id: 'site-1',
baseURL: 'http://site-1.com',
organizationId: 'org-1',
});

const org = createOrganization({
id: 'org-1',
name: 'some-org',
});

expect(isAuditsDisabled(site, org, AUDIT_TYPE_BROKEN_BACKLINKS)).to.be.true;
});
});

describe('generateCSVFile', () => {
it('should convert the JSON data to CSV', () => {
const data = [
Expand Down
1 change: 0 additions & 1 deletion packages/spacecat-shared-utils/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('Index Exports', () => {
'isString',
'toBoolean',
'isValidUrl',
'isAuditsDisabled',
'resolveSecretsName',
'resolveCustomerSecretsName',
'dateAfterDays',
Expand Down

0 comments on commit 4b8a5a2

Please sign in to comment.