Skip to content

Commit

Permalink
feat: add regulation to features.json
Browse files Browse the repository at this point in the history
  • Loading branch information
koladilip committed Jan 11, 2024
1 parent f16066c commit 2ae4378
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@
"THE_TRADE_DESK": true,
"INTERCOM": true
},
"regulation": [
"BRAZE",
"AM",
"INTERCOM",
"CLEVERTAP",
"AF",
"MP",
"GA",
"ITERABLE",
"ENGAGE",
"CUSTIFY",
"SENDGRID",
"SPRIG"
],
"supportSourceTransformV1": true,
"supportTransformerProxyV1": false
}
32 changes: 31 additions & 1 deletion test/apitests/service.api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const getDataFromPath = (pathInput) => {
return JSON.parse(testDataFile.toString());
};

describe('Basic route tests', () => {
describe('features tests', () => {
test('successful features response', async () => {
const expectedData = JSON.parse(
fs.readFileSync(path.resolve(__dirname, '../../src/features.json'), 'utf8'),
Expand All @@ -44,6 +44,36 @@ describe('Basic route tests', () => {
expect(response.status).toEqual(200);
expect(JSON.parse(response.text)).toEqual(expectedData);
});

test('features regulation should be array', async () => {
const response = await request(server).get('/features');
expect(response.status).toEqual(200);
const regulation = JSON.parse(response.text).regulation;
expect(Array.isArray(regulation)).toBeTruthy();
});

test('features routerTransform should be object', async () => {
const response = await request(server).get('/features');
expect(response.status).toEqual(200);
const routerTransform = JSON.parse(response.text).routerTransform;
expect(Array.isArray(routerTransform)).toBeFalsy();
expect(typeof routerTransform).toBe('object');
expect(Object.keys(routerTransform).length).toBeGreaterThan(0);
});

test('features supportSourceTransformV1 to be boolean', async () => {
const response = await request(server).get('/features');
expect(response.status).toEqual(200);
const supportSourceTransformV1 = JSON.parse(response.text).supportSourceTransformV1;
expect(typeof supportSourceTransformV1).toBe('boolean');
});

test('features supportTransformerProxyV1 to be boolean', async () => {
const response = await request(server).get('/features');
expect(response.status).toEqual(200);
const supportTransformerProxyV1 = JSON.parse(response.text).supportTransformerProxyV1;
expect(typeof supportTransformerProxyV1).toBe('boolean');
});
});

describe('Destination api tests', () => {
Expand Down

0 comments on commit 2ae4378

Please sign in to comment.