Fix linting errors after #13392
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -103,7 +103,7 @@ describe('TechDocsStorageClient', () => {
|
||||
identityApi.getCredentials.mockResolvedValue({});
|
||||
await storageApi.syncEntityDocs(mockEntity);
|
||||
|
||||
expect(MockedEventSource).toBeCalledWith(
|
||||
expect(MockedEventSource).toHaveBeenCalledWith(
|
||||
'http://backstage:9191/api/techdocs/sync/default/Component/test-component',
|
||||
{ withCredentials: true, headers: {} },
|
||||
);
|
||||
@@ -128,7 +128,7 @@ describe('TechDocsStorageClient', () => {
|
||||
identityApi.getCredentials.mockResolvedValue({ token: 'token' });
|
||||
await storageApi.syncEntityDocs(mockEntity);
|
||||
|
||||
expect(MockedEventSource).toBeCalledWith(
|
||||
expect(MockedEventSource).toHaveBeenCalledWith(
|
||||
'http://backstage:9191/api/techdocs/sync/default/Component/test-component',
|
||||
{ withCredentials: true, headers: { Authorization: 'Bearer token' } },
|
||||
);
|
||||
@@ -204,8 +204,8 @@ describe('TechDocsStorageClient', () => {
|
||||
storageApi.syncEntityDocs(mockEntity, logHandler),
|
||||
).resolves.toEqual('cached');
|
||||
|
||||
expect(logHandler).toBeCalledTimes(1);
|
||||
expect(logHandler).toBeCalledWith('A log message');
|
||||
expect(logHandler).toHaveBeenCalledTimes(1);
|
||||
expect(logHandler).toHaveBeenCalledWith('A log message');
|
||||
});
|
||||
|
||||
it('should throw NotFoundError', async () => {
|
||||
@@ -232,7 +232,7 @@ describe('TechDocsStorageClient', () => {
|
||||
} as any);
|
||||
|
||||
await expect(promise).rejects.toThrow(NotFoundError);
|
||||
await expect(promise).rejects.toThrowError('Some not found warning');
|
||||
await expect(promise).rejects.toThrow('Some not found warning');
|
||||
});
|
||||
|
||||
it('should throw generic errors', async () => {
|
||||
@@ -259,7 +259,7 @@ describe('TechDocsStorageClient', () => {
|
||||
} as any);
|
||||
|
||||
await expect(promise).rejects.toThrow(Error);
|
||||
await expect(promise).rejects.toThrowError('Some other error');
|
||||
await expect(promise).rejects.toThrow('Some other error');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ describe('<TechDocsBuildLogsDrawerContent />', () => {
|
||||
await rendered.findByText(/Waiting for logs.../i),
|
||||
).toBeInTheDocument();
|
||||
|
||||
expect(onClose).toBeCalledTimes(0);
|
||||
expect(onClose).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('should render logs', async () => {
|
||||
@@ -69,7 +69,7 @@ describe('<TechDocsBuildLogsDrawerContent />', () => {
|
||||
expect(await rendered.findByText(/Line 1/i)).toBeInTheDocument();
|
||||
expect(await rendered.findByText(/Line 2/i)).toBeInTheDocument();
|
||||
|
||||
expect(onClose).toBeCalledTimes(0);
|
||||
expect(onClose).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
|
||||
it('should call onClose', async () => {
|
||||
@@ -79,6 +79,6 @@ describe('<TechDocsBuildLogsDrawerContent />', () => {
|
||||
);
|
||||
rendered.getByTitle('Close the drawer').click();
|
||||
|
||||
expect(onClose).toBeCalledTimes(1);
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -312,11 +312,11 @@ describe('useReaderState', () => {
|
||||
contentReload: expect.any(Function),
|
||||
});
|
||||
|
||||
expect(techdocsStorageApi.getEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.getEntityDocs).toHaveBeenCalledWith(
|
||||
{ kind: 'Component', namespace: 'default', name: 'backstage' },
|
||||
'/example',
|
||||
);
|
||||
expect(techdocsStorageApi.syncEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.syncEntityDocs).toHaveBeenCalledWith(
|
||||
{
|
||||
kind: 'Component',
|
||||
namespace: 'default',
|
||||
@@ -397,13 +397,13 @@ describe('useReaderState', () => {
|
||||
contentReload: expect.any(Function),
|
||||
});
|
||||
|
||||
expect(techdocsStorageApi.getEntityDocs).toBeCalledTimes(2);
|
||||
expect(techdocsStorageApi.getEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.getEntityDocs).toHaveBeenCalledTimes(2);
|
||||
expect(techdocsStorageApi.getEntityDocs).toHaveBeenCalledWith(
|
||||
{ kind: 'Component', namespace: 'default', name: 'backstage' },
|
||||
'/example',
|
||||
);
|
||||
expect(techdocsStorageApi.syncEntityDocs).toBeCalledTimes(1);
|
||||
expect(techdocsStorageApi.syncEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.syncEntityDocs).toHaveBeenCalledTimes(1);
|
||||
expect(techdocsStorageApi.syncEntityDocs).toHaveBeenCalledWith(
|
||||
{
|
||||
kind: 'Component',
|
||||
namespace: 'default',
|
||||
@@ -511,12 +511,12 @@ describe('useReaderState', () => {
|
||||
contentReload: expect.any(Function),
|
||||
});
|
||||
|
||||
expect(techdocsStorageApi.getEntityDocs).toBeCalledTimes(2);
|
||||
expect(techdocsStorageApi.getEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.getEntityDocs).toHaveBeenCalledTimes(2);
|
||||
expect(techdocsStorageApi.getEntityDocs).toHaveBeenCalledWith(
|
||||
{ kind: 'Component', namespace: 'default', name: 'backstage' },
|
||||
'/example',
|
||||
);
|
||||
expect(techdocsStorageApi.syncEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.syncEntityDocs).toHaveBeenCalledWith(
|
||||
{
|
||||
kind: 'Component',
|
||||
namespace: 'default',
|
||||
@@ -607,15 +607,15 @@ describe('useReaderState', () => {
|
||||
contentReload: expect.any(Function),
|
||||
});
|
||||
|
||||
expect(techdocsStorageApi.getEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.getEntityDocs).toHaveBeenCalledWith(
|
||||
{ kind: 'Component', namespace: 'default', name: 'backstage' },
|
||||
'/example',
|
||||
);
|
||||
expect(techdocsStorageApi.getEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.getEntityDocs).toHaveBeenCalledWith(
|
||||
{ kind: 'Component', namespace: 'default', name: 'backstage' },
|
||||
'/new',
|
||||
);
|
||||
expect(techdocsStorageApi.syncEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.syncEntityDocs).toHaveBeenCalledWith(
|
||||
{
|
||||
kind: 'Component',
|
||||
namespace: 'default',
|
||||
@@ -660,11 +660,11 @@ describe('useReaderState', () => {
|
||||
contentReload: expect.any(Function),
|
||||
});
|
||||
|
||||
expect(techdocsStorageApi.getEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.getEntityDocs).toHaveBeenCalledWith(
|
||||
{ kind: 'Component', namespace: 'default', name: 'backstage' },
|
||||
'/example',
|
||||
);
|
||||
expect(techdocsStorageApi.syncEntityDocs).toBeCalledWith(
|
||||
expect(techdocsStorageApi.syncEntityDocs).toHaveBeenCalledWith(
|
||||
{
|
||||
kind: 'Component',
|
||||
namespace: 'default',
|
||||
|
||||
@@ -66,7 +66,7 @@ describe('<TechDocsSearch />', () => {
|
||||
);
|
||||
|
||||
await emptyResults;
|
||||
expect(querySpy).toBeCalled();
|
||||
expect(querySpy).toHaveBeenCalled();
|
||||
expect(rendered.getByTestId('techdocs-search-bar')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -88,7 +88,7 @@ describe('<TechDocsSearch />', () => {
|
||||
);
|
||||
|
||||
await singleResult;
|
||||
expect(querySpy).toBeCalledWith({
|
||||
expect(querySpy).toHaveBeenCalledWith({
|
||||
filters: {
|
||||
kind: 'Testable',
|
||||
name: 'test',
|
||||
@@ -107,7 +107,7 @@ describe('<TechDocsSearch />', () => {
|
||||
|
||||
await singleResult;
|
||||
await waitFor(() =>
|
||||
expect(querySpy).toBeCalledWith({
|
||||
expect(querySpy).toHaveBeenCalledWith({
|
||||
filters: {
|
||||
kind: 'Testable',
|
||||
name: 'test',
|
||||
@@ -148,7 +148,7 @@ describe('<TechDocsSearch />', () => {
|
||||
const rendered = render(<WrappedSearchBar />);
|
||||
|
||||
await singleResult;
|
||||
expect(querySpy).toBeCalledWith({
|
||||
expect(querySpy).toHaveBeenCalledWith({
|
||||
filters: {
|
||||
kind: 'Testable',
|
||||
name: 'test',
|
||||
@@ -164,7 +164,7 @@ describe('<TechDocsSearch />', () => {
|
||||
|
||||
await singleResult;
|
||||
await waitFor(() =>
|
||||
expect(querySpy).toBeCalledWith({
|
||||
expect(querySpy).toHaveBeenCalledWith({
|
||||
filters: {
|
||||
kind: 'TestableDiff',
|
||||
name: 'test-diff',
|
||||
|
||||
Reference in New Issue
Block a user