Skip to content

Commit

Permalink
feat: strf-9345: Log api host
Browse files Browse the repository at this point in the history
  • Loading branch information
jmwiese committed Sep 9, 2021
1 parent 403d51c commit 51b08a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions lib/stencil-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,26 @@ class StencilInit {
}

apiHostFromStoreUrl(storeUrl) {
let host = null;
if (storeUrl !== undefined) {
if (storeUrl.includes('service.bcdev')) {
return DEV_API_HOST;
host = DEV_API_HOST;
}
if (storeUrl.includes('my-integration.zone')) {
return INTG_API_HOST;
host = INTG_API_HOST;
}
if (storeUrl.includes('my-staging.zone')) {
return STG_API_HOST;
host = STG_API_HOST;
}
}

return API_HOST;
if (host === null) {
host = API_HOST;
}

console.log('Set API host to: ' + host);

return host;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/stencil-init.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('StencilInit integration tests', () => {

expect(inquirerPromptStub).toHaveBeenCalledTimes(1);
expect(consoleErrorStub).toHaveBeenCalledTimes(0);
expect(consoleLogStub).toHaveBeenCalledTimes(1);
expect(consoleLogStub).toHaveBeenCalledTimes(2);
expect(saveStencilConfigStub).toHaveBeenCalledTimes(1);

expect(saveStencilConfigStub).toHaveBeenCalledWith(expectedResult);
Expand Down Expand Up @@ -134,7 +134,7 @@ describe('StencilInit integration tests', () => {

expect(inquirerPromptStub).toHaveBeenCalledTimes(0);
expect(consoleErrorStub).toHaveBeenCalledTimes(0);
expect(consoleLogStub).toHaveBeenCalledTimes(1);
expect(consoleLogStub).toHaveBeenCalledTimes(2);
expect(saveStencilConfigStub).toHaveBeenCalledTimes(1);

expect(saveStencilConfigStub).toHaveBeenCalledWith(expectedResult);
Expand Down

0 comments on commit 51b08a9

Please sign in to comment.