Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/models/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/models/config-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/models/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/models/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/services/config-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/services/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/services/group-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/services/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions tests/component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand All @@ -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 () => {
Expand Down
8 changes: 4 additions & 4 deletions tests/config-strategy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -665,15 +665,15 @@ 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}`)
.send({
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 () => {
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/environment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand All @@ -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 () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/group-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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 () => {
Expand Down