Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed Jan 3, 2020
1 parent 2f50541 commit 5a4057d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
29 changes: 1 addition & 28 deletions x-pack/legacy/plugins/alerting/server/routes/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,7 @@ test('creates an alert with proper parameters', async () => {
expect(statusCode).toBe(200);
const response = JSON.parse(payload);
expect(new Date(response.createdAt)).toEqual(createdAt);
expect(omit(response, 'createdAt')).toMatchInlineSnapshot(`
Object {
"actions": Array [
Object {
"actionTypeId": "test",
"group": "default",
"id": "2",
"params": Object {
"foo": true,
},
},
],
"alertTypeId": "1",
"consumer": "bar",
"id": "123",
"name": "abc",
"params": Object {
"bar": true,
},
"schedule": Object {
"interval": "10s",
},
"tags": Array [
"foo",
],
"updatedAt": null,
}
`);
expect(omit(response, 'createdAt', 'updatedAt')).toMatchInlineSnapshot();
expect(alertsClient.create).toHaveBeenCalledTimes(1);
expect(alertsClient.create.mock.calls[0]).toMatchInlineSnapshot(`
Array [
Expand Down
6 changes: 4 additions & 2 deletions x-pack/legacy/plugins/alerting/server/routes/get.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ test('calls get with proper parameters', async () => {
alertsClient.get.mockResolvedValueOnce(mockedAlert);
const { payload, statusCode } = await server.inject(request);
expect(statusCode).toBe(200);
const { createdAt, ...response } = JSON.parse(payload);
expect({ createdAt: new Date(createdAt), ...response }).toEqual(mockedAlert);
const { createdAt, updatedAt, ...response } = JSON.parse(payload);
expect({ createdAt: new Date(createdAt), updatedAt: new Date(updatedAt), ...response }).toEqual(
mockedAlert
);
expect(alertsClient.get).toHaveBeenCalledTimes(1);
expect(alertsClient.get.mock.calls[0]).toMatchInlineSnapshot(`
Array [
Expand Down

0 comments on commit 5a4057d

Please sign in to comment.