Skip to content

Commit

Permalink
feat: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
alinarublea committed Jan 18, 2024
1 parent ab64a2e commit 67cc07e
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Adobe. All rights reserved.
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Adobe. All rights reserved.
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand All @@ -13,7 +13,7 @@
import { hasText, isObject } from '@adobe/spacecat-shared-utils';

import { Base } from './base.js';
import { Config, defaultConfig } from './site/config.js';
import { Config, DEFAULT_CONFIG } from './site/config.js';

/**
* Creates a new Organization.
Expand Down Expand Up @@ -88,7 +88,7 @@ export const createOrganization = (data) => {
const newState = { ...data };

if (!isObject(newState.config)) {
newState.config = { ...defaultConfig };
newState.config = { ...DEFAULT_CONFIG };
}
if (!hasText(newState.name)) {
throw new Error('Org name must be provided');
Expand Down
4 changes: 2 additions & 2 deletions packages/spacecat-shared-data-access/src/models/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { isObject, isValidUrl } from '@adobe/spacecat-shared-utils';

import { Base } from './base.js';
import AuditConfig from './site/audit-config.js';
import { Config, defaultConfig } from './site/config.js';
import { Config, DEFAULT_CONFIG } from './site/config.js';

export const DELIVERY_TYPES = {
AEM_CS: 'aem_cs',
Expand Down Expand Up @@ -185,7 +185,7 @@ export const createSite = (data) => {
newState.auditConfig = AuditConfig(newState.auditConfig);

if (!isObject(newState.config)) {
newState.config = { ...defaultConfig };
newState.config = { ...DEFAULT_CONFIG };
}

newState.config = Config(newState.config);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Adobe. All rights reserved.
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand All @@ -24,7 +24,7 @@ export const configSchema = Joi.object({
})),
});

export const defaultConfig = {
export const DEFAULT_CONFIG = {
slack: {
},
alerts: [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Adobe. All rights reserved.
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Adobe. All rights reserved.
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export const getSiteByBaseURLWithLatestAudit = async (
auditType,
) => getSiteByBaseURLWithAuditInfo(dynamoClient, config, log, baseUrl, auditType, true);

export const getSitesByOrganizationId = async (
export const getSitesByOrganizationID = async (
dynamoClient,
config,
organizationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
getSiteByBaseURLWithAudits,
getSiteByBaseURLWithLatestAudit,
getSiteByID,
getSites, getSitesByDeliveryType, getSitesByOrganizationId,
getSites, getSitesByDeliveryType, getSitesByOrganizationID,
getSitesToAudit,
getSitesWithLatestAudit, removeSite,
updateSite,
Expand All @@ -33,7 +33,7 @@ export const siteFunctions = (dynamoClient, config, log) => ({
config,
deliveryType,
),
getSitesByOrganizationId: (organizationId) => getSitesByOrganizationId(
getSitesByOrganizationID: (organizationId) => getSitesByOrganizationID(
dynamoClient,
config,
organizationId,
Expand Down
2 changes: 1 addition & 1 deletion packages/spacecat-shared-data-access/test/it/db.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ describe('DynamoDB Integration Test', async () => {

it('gets sites by organizationId', async () => {
const organizations = await dataAccess.getOrganizations();
const sites = await dataAccess.getSitesByOrganizationId(organizations[0].getId());
const sites = await dataAccess.getSitesByOrganizationID(organizations[0].getId());

expect(sites.length).to.be.lessThanOrEqual(Math.trunc(NUMBER_OF_SITES / NUMBER_OF_ORGANIZATIONS)
+ (NUMBER_OF_SITES % NUMBER_OF_ORGANIZATIONS));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Adobe. All rights reserved.
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Adobe. All rights reserved.
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Data Access Object Tests', () => {
'removeSite',
'getSites',
'getSitesByDeliveryType',
'getSitesByOrganizationId',
'getSitesByOrganizationID',
'getSitesToAudit',
'getSitesWithLatestAudit',
'getSiteByBaseURL',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Adobe. All rights reserved.
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ describe('Site Access Pattern Tests', () => {
expect(exportedFunctions.getSitesByDeliveryType).to.be.a('function');
});

it('exports getSitesByOrganizationId function', () => {
expect(exportedFunctions).to.have.property('getSitesByOrganizationId');
expect(exportedFunctions.getSitesByOrganizationId).to.be.a('function');
it('exports getSitesByOrganizationID function', () => {
expect(exportedFunctions).to.have.property('getSitesByOrganizationID');
expect(exportedFunctions.getSitesByOrganizationID).to.be.a('function');
});

it('exports getSitesToAudit function', () => {
Expand Down Expand Up @@ -115,8 +115,8 @@ describe('Site Access Pattern Tests', () => {
expect(mockDynamoClient.query.called).to.be.true;
});

it('calls getSitesByOrganizationId and returns an array', async () => {
const result = await exportedFunctions.getSitesByOrganizationId('OrgId1');
it('calls getSitesByOrganizationID and returns an array', async () => {
const result = await exportedFunctions.getSitesByOrganizationID('OrgId1');
expect(result).to.be.an('array');
expect(mockDynamoClient.query.called).to.be.true;
});
Expand Down

0 comments on commit 67cc07e

Please sign in to comment.