Skip to content

Commit

Permalink
Updated YARD unit tests - added UK, denver case (#266)
Browse files Browse the repository at this point in the history
Co-authored-by: bryan-tabarez <[email protected]>
  • Loading branch information
BryanTabarez and bryan-tabarez authored Apr 27, 2023
1 parent 1c00a5d commit 6b6f2f2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@al/core",
"version": "1.0.201",
"version": "1.0.202",
"description": "Node Enterprise Packages for Alert Logic (NEPAL) Core Library",
"main": "./dist/index.cjs.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/common/navigation/al-location.dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ export const AlLocationDictionary: AlLocationDescriptor[] =
insightLocationId: 'defender-uk-newport',
uri: 'https://yard.alertlogic.co.uk',
environment: 'production|production-staging',
residency: "UK"
residency: "EMEA"
},
];

14 changes: 14 additions & 0 deletions test/client/al-api-client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ describe("AlDefaultClient", () => {
} );
describe('for a YARD API Endpoint', () => {
it('should properly resolve the full URL', async () => {
AlLocatorService.setContext( { environment:'production', residency: 'EMEA', insightLocationId: 'defender-uk-newport' } );
const config: APIRequestParams = {
service_stack: AlLocation.YARDAPI,
version: 1,
Expand All @@ -541,6 +542,19 @@ describe("AlDefaultClient", () => {
let fullURL = await AlDefaultClient.fromConfigToFullUrl(config);
expect(fullURL).to.equal("https://yard.alertlogic.co.uk/v1/12345678/something/wicked?this-way=comes");
});
it('should properly resolve the full URL in a different datacenter', async () => {
AlLocatorService.setContext( { environment:'production', residency: 'US', insightLocationId: 'defender-us-denver' } );
const config: APIRequestParams = {
service_stack: AlLocation.YARDAPI,
version: 1,
account_id: "12345678",
path: '/something/wicked',
params: { 'this-way': 'comes' },
method: 'GET',
};
let fullURL = await AlDefaultClient.fromConfigToFullUrl(config);
expect(fullURL).to.equal("https://yard.alertlogic.com/v1/12345678/something/wicked?this-way=comes");
});
});
});
describe('when flushCacheKeys is present',() => {
Expand Down

0 comments on commit 6b6f2f2

Please sign in to comment.