Skip to content

Commit

Permalink
fix(infra): update test types
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Antonio Ghiani committed Apr 24, 2023
1 parent 0b71493 commit 88466a4
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import { createInfraSourcesMock } from '../../lib/sources/mocks';
import { inventoryViewSavedObjectName } from '../../saved_objects/inventory_view';
import { InventoryViewsClient } from './inventory_views_client';
import { createInventoryViewMock } from '../../../common/inventory_views/inventory_view.mock';
import {
CreateInventoryViewAttributesRequestPayload,
UpdateInventoryViewAttributesRequestPayload,
} from '../../../common/http_api/latest';

describe('InventoryViewsClient class', () => {
const mockFindInventoryList = (savedObjectsClient: jest.Mocked<SavedObjectsClientContract>) => {
Expand Down Expand Up @@ -130,7 +134,7 @@ describe('InventoryViewsClient class', () => {

const inventoryView = await inventoryViewsClient.create({
name: 'New view',
} as InventoryViewAttributes);
} as CreateInventoryViewAttributesRequestPayload);

expect(savedObjectsClient.create).toHaveBeenCalled();
expect(inventoryView).toEqual(inventoryViewMock);
Expand All @@ -145,7 +149,7 @@ describe('InventoryViewsClient class', () => {
async () =>
await inventoryViewsClient.create({
name: 'Custom',
} as InventoryViewAttributes)
} as CreateInventoryViewAttributesRequestPayload)
).rejects.toThrow('A view with that name already exists.');
});
});
Expand Down Expand Up @@ -177,7 +181,7 @@ describe('InventoryViewsClient class', () => {
'default_id',
{
name: 'New name',
} as InventoryViewAttributes,
} as UpdateInventoryViewAttributesRequestPayload,
{}
);

Expand All @@ -196,7 +200,7 @@ describe('InventoryViewsClient class', () => {
'default_id',
{
name: 'Custom',
} as InventoryViewAttributes,
} as UpdateInventoryViewAttributesRequestPayload,
{}
)
).rejects.toThrow('A view with that name already exists.');
Expand Down

0 comments on commit 88466a4

Please sign in to comment.