diff --git a/src/models/component.js b/src/models/component.js index d6b294f..3515529 100644 --- a/src/models/component.js +++ b/src/models/component.js @@ -118,9 +118,9 @@ const existComponent = async ({ domain, name, __v }) => { componentSchema.pre('validate', async function (next) { const component = this; - // Verify if component already exist + // Verify if component already exists if (await existComponent(component)) { - const err = new Error(`Unable to complete the operation. Component '${component.name}' already exist for this Domain`); + const err = new Error(`Unable to complete the operation. Component '${component.name}' already exists for this Domain`); next(err); } diff --git a/src/models/config-strategy.js b/src/models/config-strategy.js index 978e768..88ce180 100644 --- a/src/models/config-strategy.js +++ b/src/models/config-strategy.js @@ -397,9 +397,9 @@ configStrategySchema.pre('save', async function (next) { const operationStrategy = strategyConfig.operation; const { min, max } = OperationValuesValidation.filter(element => element.operation === operationStrategy)[0]; - // Verify if strategy already exist + // Verify if strategy already exists if (await existStrategy(strategyConfig)) { - const err = new Error(`Unable to complete the operation. Strategy '${strategy}' already exist for this configuration and environment`); + const err = new Error(`Unable to complete the operation. Strategy '${strategy}' already exists for this configuration and environment`); return next(err); } diff --git a/src/models/environment.js b/src/models/environment.js index 34cfa3f..97257b6 100644 --- a/src/models/environment.js +++ b/src/models/environment.js @@ -46,7 +46,7 @@ environmentSchema.pre('validate', async function (next) { const existEnv = await Environment.findOne({ name, domain }).exec(); if (existEnv) { - const err = new Error(`Unable to complete the operation. Environment '${name}' already exist for this Domain`); + const err = new Error(`Unable to complete the operation. Environment '${name}' already exists for this Domain`); next(err); } diff --git a/src/models/team.js b/src/models/team.js index 9c9c680..b44cf31 100644 --- a/src/models/team.js +++ b/src/models/team.js @@ -69,9 +69,9 @@ const existTeam = async (team) => { teamSchema.pre('validate', async function (next) { const team = this; - // Verify if team already exist + // Verify if team already exists if (await existTeam(team)) { - const err = new Error(`Unable to complete the operation. Team '${team.name}' already exist for this Domain`); + const err = new Error(`Unable to complete the operation. Team '${team.name}' already exists for this Domain`); next(err); } diff --git a/src/services/config-strategy.js b/src/services/config-strategy.js index 35b4f01..6fde681 100644 --- a/src/services/config-strategy.js +++ b/src/services/config-strategy.js @@ -111,7 +111,7 @@ export async function addVal(id, args, admin) { validateValues([value]); if (foundExistingOne) { - throw new BadRequestError(`Value '${value}' already exist`); + throw new BadRequestError(`Value '${value}' already exists`); } configStrategy = await verifyOwnership(admin, configStrategy, configStrategy.domain, ActionTypes.UPDATE, @@ -144,7 +144,7 @@ export async function updateVal(id, args, admin) { validateValues([newvalue]); if (indexNewValue >= 0) { - throw new BadRequestError(`Value '${newvalue}' already exist`); + throw new BadRequestError(`Value '${newvalue}' already exists`); } configStrategy = await verifyOwnership(admin, configStrategy, configStrategy.domain, ActionTypes.UPDATE, diff --git a/src/services/config.js b/src/services/config.js index 67575a1..a936d89 100644 --- a/src/services/config.js +++ b/src/services/config.js @@ -73,7 +73,7 @@ export async function createConfig(args, admin) { }); if (config) { - throw new BadRequestError(`Config ${config.key} already exist`); + throw new BadRequestError(`Config ${args.key} already exists`); } config = new Config({ @@ -122,7 +122,7 @@ export async function updateConfig(id, args, admin) { }); if (duplicatedKey) { - throw new BadRequestError(`Config ${args.key} already exist`); + throw new BadRequestError(`Config ${args.key} already exists`); } // resets permission cache diff --git a/src/services/group-config.js b/src/services/group-config.js index df084e4..59fcd23 100644 --- a/src/services/group-config.js +++ b/src/services/group-config.js @@ -59,7 +59,7 @@ export async function createGroup(args, admin) { // validates existing group config let group = await getGroupConfig({ name: args.name, domain: args.domain }); if (group) { - throw new BadRequestError(`Group ${group.name} already exist`); + throw new BadRequestError(`Group ${group.name} already exists`); } const domain = await getDomainById(args.domain); @@ -102,7 +102,7 @@ export async function updateGroup(id, args, admin) { let groupFound = await getGroupConfig({ name: args.name, domain: groupconfig.domain }); if (groupFound) { - throw new BadRequestError(`Group ${args.name} already exist`); + throw new BadRequestError(`Group ${args.name} already exists`); } // resets permission cache diff --git a/src/services/permission.js b/src/services/permission.js index 6dee5cc..bcdf1c1 100644 --- a/src/services/permission.js +++ b/src/services/permission.js @@ -87,7 +87,7 @@ export async function addValue(args, id, admin) { const value = args.value.trim(); if (permission.values.includes(value)) { - throw new BadRequestError(`Value '${value}' already exist`); + throw new BadRequestError(`Value '${value}' already exists`); } permission.values.push(value); diff --git a/tests/component.test.js b/tests/component.test.js index ba912eb..be85148 100644 --- a/tests/component.test.js +++ b/tests/component.test.js @@ -52,7 +52,7 @@ describe('Insertion tests', () => { component1Id = response.body.component._id; }); - test('COMPONENT_SUITE - Should NOT create a new Component - Component already exist', async () => { + test('COMPONENT_SUITE - Should NOT create a new Component - Component already exists', async () => { const response = await request(app) .post('/component/create') .set('Authorization', `Bearer ${adminMasterAccountToken}`) @@ -62,7 +62,7 @@ describe('Insertion tests', () => { domain: domainId }).expect(400); - expect(response.body.error).toBe('Unable to complete the operation. Component \'my-web-app\' already exist for this Domain'); + expect(response.body.error).toBe('Unable to complete the operation. Component \'my-web-app\' already exists for this Domain'); }); test('COMPONENT_SUITE - Should NOT create a new Component - Domain not found', async () => { diff --git a/tests/config-strategy.test.js b/tests/config-strategy.test.js index 7776882..d619496 100644 --- a/tests/config-strategy.test.js +++ b/tests/config-strategy.test.js @@ -96,7 +96,7 @@ describe('Testing strategy creation #1', () => { }).expect(400); expect(response.body.error) - .toBe(`Unable to complete the operation. Strategy '${StrategiesType.VALUE}' already exist for this configuration and environment`); + .toBe(`Unable to complete the operation. Strategy '${StrategiesType.VALUE}' already exists for this configuration and environment`); }); test('STRATEGY_SUITE - Should NOT create a new Config Strategy - Operation not available', async () => { @@ -665,7 +665,7 @@ describe('Testing update strategies #1', () => { expect('USER_4').toEqual(foundExistingOne); }); - test('STRATEGY_SUITE - Should NOT add new value to Strategy values - Value already exist', async () => { + test('STRATEGY_SUITE - Should NOT add new value to Strategy values - Value already exists', async () => { const response = await request(app) .patch('/configstrategy/addval/' + configStrategyId) .set('Authorization', `Bearer ${adminMasterAccountToken}`) @@ -673,7 +673,7 @@ describe('Testing update strategies #1', () => { value: 'USER_3' }).expect(400); - expect(response.body.error).toEqual('Value \'USER_3\' already exist'); + expect(response.body.error).toEqual('Value \'USER_3\' already exists'); }); test('STRATEGY_SUITE - Should NOT add new value to Strategy values - Invalid parameter', async () => { @@ -776,7 +776,7 @@ describe('Testing update strategies #2', () => { newvalue: 'USER_2' }).expect(400); - expect(response.body.error).toEqual('Value \'USER_2\' already exist'); + expect(response.body.error).toEqual('Value \'USER_2\' already exists'); response = await request(app) .patch('/configstrategy/updateval/' + configStrategyId) diff --git a/tests/config.test.js b/tests/config.test.js index ed5d4c1..98d5c36 100644 --- a/tests/config.test.js +++ b/tests/config.test.js @@ -57,7 +57,7 @@ describe('Testing configuration insertion', () => { group: groupConfigId }).expect(400); - expect(response.body.error).toBe('Config NEW_CONFIG already exist'); + expect(response.body.error).toBe('Config NEW_CONFIG already exists'); }); test('CONFIG_SUITE - Should NOT create a new Config - with wrong group config Id', async () => { @@ -279,7 +279,7 @@ describe('Testing update info', () => { .set('Authorization', `Bearer ${adminMasterAccountToken}`) .send({ key: 'NEWKEY' }).expect(400); - expect(response.body.error).toEqual('Config NEWKEY already exist'); + expect(response.body.error).toEqual('Config NEWKEY already exists'); }); test('CONFIG_SUITE - Should NOT update Config info', async () => { diff --git a/tests/environment.test.js b/tests/environment.test.js index eaea0be..a4c4148 100644 --- a/tests/environment.test.js +++ b/tests/environment.test.js @@ -52,7 +52,7 @@ describe('Insertion tests', () => { }).expect(403); }); - test('ENV_SUITE - Should NOT create a new Environment - Environment already exist', async () => { + test('ENV_SUITE - Should NOT create a new Environment - Environment already exists', async () => { const response = await request(app) .post('/environment/create') .set('Authorization', `Bearer ${adminMasterAccountToken}`) @@ -61,7 +61,7 @@ describe('Insertion tests', () => { domain: domainId }).expect(400); - expect(response.body.error).toBe(`Unable to complete the operation. Environment '${EnvType.DEFAULT}' already exist for this Domain`); + expect(response.body.error).toBe(`Unable to complete the operation. Environment '${EnvType.DEFAULT}' already exists for this Domain`); }); test('ENV_SUITE - Should NOT create a new Environment - Domain not found', async () => { diff --git a/tests/group-config.test.js b/tests/group-config.test.js index 65b3a49..6804172 100644 --- a/tests/group-config.test.js +++ b/tests/group-config.test.js @@ -57,7 +57,7 @@ describe('Testing Group insertion', () => { domain: domainId }).expect(400); - expect(response.body.error).toBe('Group New Group Config already exist'); + expect(response.body.error).toBe('Group New Group Config already exists'); }); test('GROUP_SUITE - Should not create a new Group Config - with wrong domain Id', async () => { @@ -257,7 +257,7 @@ describe('Testing update Group info', () => { name: 'Updated Group Name' }).expect(400); - expect(response.body.error).toEqual('Group Updated Group Name already exist'); + expect(response.body.error).toEqual('Group Updated Group Name already exists'); }); test('GROUP_SUITE - Should NOT update Group Config info', async () => {