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
3 changes: 3 additions & 0 deletions src/api-docs/paths/path-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export default {
reason: {
type: 'string'
},
metadata: {
type: 'object'
},
strategies: {
type: 'array',
items: configStrategy.ConfigStrategy
Expand Down
35 changes: 0 additions & 35 deletions src/api-docs/schemas/config-strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,41 +31,6 @@ const configStrategy = {
operation: {
type: 'string',
enum: Object.values(OperationsType)
},
config: {
type: 'string',
description: 'The config ID parent of the config strategy',
format: 'uuid'
},
domain: {
type: 'string',
description: 'The domain ID parent of the config strategy',
format: 'uuid'
},
owner: {
type: 'string',
description: 'The owner id of the config strategy'
},
admin: {
type: 'object',
properties: {
_id: {
type: 'string',
description: 'The unique identifier of the admin'
},
name: {
type: 'string',
description: 'The name of the admin who created the config strategy'
}
}
},
createdAt: {
type: 'string',
description: 'The date when the config strategy was created'
},
updatedAt: {
type: 'string',
description: 'The date when the config strategy was updated'
}
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/client/relay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export async function resolveValidation(relay, entry, environment) {

return {
result: response.data.result,
message: response.data.message
message: response.data.message,
metadata: response.data.metadata
};
}

Expand Down
3 changes: 2 additions & 1 deletion src/client/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ async function resolveRelay(config, environment, entry, response) {
resolveNotification(config.relay, entry, environment);
} else {
const relayResponse = await resolveValidation(config.relay, entry, environment);

response.result = relayResponse.result;
response.reason = relayResponse.result ? 'Success' : 'Relay does not agree';
response.message = relayResponse.message;
response.metadata = relayResponse.metadata;
}
}
} catch (e) {
Expand Down
4 changes: 3 additions & 1 deletion tests/relay.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Testing Switcher Relay', () => {
axiosStub = sinon.stub(axios, 'get');

// Given
const mockRelayService = { data: { result: true, reason: 'Success' } };
const mockRelayService = { data: { result: true, message: 'A message', metadata: { custom: 'VALUE' } } };
axiosStub.returns(Promise.resolve(mockRelayService));

// Setup Switcher
Expand All @@ -122,7 +122,9 @@ describe('Testing Switcher Relay', () => {
axiosStub.restore();
expect(req.statusCode).toBe(200);
expect(req.body.reason).toEqual('Success');
expect(req.body.message).toBe('A message');
expect(req.body.result).toBe(true);
expect(req.body.metadata).toEqual({ custom: 'VALUE' });
});

test('RELAY_SUITE - Should return success when validating relay using POST method', async () => {
Expand Down