make stack overflow api constructor private

Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
Brian Fletcher
2022-08-30 15:44:26 +01:00
parent 83d83eb882
commit 68ff05fbe5
2 changed files with 9 additions and 4 deletions
@@ -19,6 +19,7 @@ import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { StackOverflowClient } from './index';
import { StackOverflowQuestion } from '../types';
import { ConfigReader } from '@backstage/config';
const server = setupServer();
@@ -61,9 +62,13 @@ describe('StackOverflowClient', () => {
it('list questions should return all questions', async () => {
setupHandlers();
const client = new StackOverflowClient({
baseUrl: 'https://example.com:9191',
});
const client = StackOverflowClient.fromConfig(
new ConfigReader({
stackoverflow: {
baseUrl: 'https://example.com:9191',
},
}),
);
const responseQuestions = await client.listQuestions({
requestParams: { tagged: 'backstage' },
@@ -26,7 +26,7 @@ import { Config } from '@backstage/config';
export class StackOverflowClient implements StackOverflowApi {
private baseUrl: string;
constructor({ baseUrl }: { baseUrl: string }) {
private constructor({ baseUrl }: { baseUrl: string }) {
this.baseUrl = baseUrl;
}