Skip to content

Commit

Permalink
check suffix only in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jcger committed Nov 27, 2024
1 parent 1a44804 commit 2ea6b1c
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 48 deletions.
11 changes: 8 additions & 3 deletions x-pack/plugins/alerting/server/routes/legacy/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -597,16 +597,21 @@ describe('createAlertRoute', () => {

const [config] = router.post.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "POST",
"newApiPath": "/api/alerting/rule/{id?}",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
11 changes: 8 additions & 3 deletions x-pack/plugins/alerting/server/routes/legacy/delete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,21 @@ describe('deleteAlertRoute', () => {

const [config] = router.delete.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "DELETE",
"newApiPath": "/api/alerting/rule/{id}",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
11 changes: 8 additions & 3 deletions x-pack/plugins/alerting/server/routes/legacy/disable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,21 @@ describe('disableAlertRoute', () => {

const [config] = router.post.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "POST",
"newApiPath": "/api/alerting/rule/{id}/_disable",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
11 changes: 8 additions & 3 deletions x-pack/plugins/alerting/server/routes/legacy/enable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,21 @@ describe('enableAlertRoute', () => {

const [config] = router.post.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "POST",
"newApiPath": "/api/alerting/rule/{id}/_enable",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
11 changes: 8 additions & 3 deletions x-pack/plugins/alerting/server/routes/legacy/find.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,16 +419,21 @@ describe('findAlertRoute', () => {

const [config] = router.get.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "GET",
"newApiPath": "/api/alerting/rules/_find",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
11 changes: 8 additions & 3 deletions x-pack/plugins/alerting/server/routes/legacy/get.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,21 @@ describe('getAlertRoute', () => {
getAlertRoute(router, licenseState, docLinks);
const [config] = router.get.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "GET",
"newApiPath": "/api/alerting/rule/{id}",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,19 @@ describe('getAlertInstanceSummaryRoute', () => {

const [config] = router.get.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"type": "remove",
},
"severity": "warning",
}
`);
`
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,19 @@ describe('getAlertStateRoute', () => {

const [config] = router.get.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"type": "remove",
},
"severity": "warning",
}
`);
`
);
});
});
11 changes: 8 additions & 3 deletions x-pack/plugins/alerting/server/routes/legacy/health.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,16 +453,21 @@ describe('healthRoute', () => {

const [config] = router.get.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "GET",
"newApiPath": "/api/alerting/rule/_health",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,21 @@ describe('listAlertTypesRoute', () => {

const [config] = router.get.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "GET",
"newApiPath": "/api/alerting/rule_types",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
11 changes: 8 additions & 3 deletions x-pack/plugins/alerting/server/routes/legacy/mute_all.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,21 @@ describe('muteAllAlertRoute', () => {

const [config] = router.post.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "POST",
"newApiPath": "/api/alerting/rule/{id}/_mute_all",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,21 @@ describe('muteAlertInstanceRoute', () => {

const [config] = router.post.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "POST",
"newApiPath": "/api/alerting/rule/{rule_id}/alert/{alert_id}/_mute",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
11 changes: 8 additions & 3 deletions x-pack/plugins/alerting/server/routes/legacy/unmute_all.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,21 @@ describe('unmuteAllAlertRoute', () => {

const [config] = router.post.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "POST",
"newApiPath": "/api/alerting/rule/{id}/_unmute_all",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,21 @@ describe('unmuteAlertInstanceRoute', () => {

const [config] = router.post.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "POST",
"newApiPath": "/api/alerting/rule/{rule_id}/alert/{alert_id}/_unmute",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
11 changes: 8 additions & 3 deletions x-pack/plugins/alerting/server/routes/legacy/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,16 +370,21 @@ describe('updateAlertRoute', () => {

const [config] = router.put.mock.calls[0];

expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "PUT",
"newApiPath": "/api/alerting/rule/rule/{id}",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,21 @@ describe('updateApiKeyRoute', () => {
updateApiKeyRoute(router, licenseState, docLinks);

const [config] = router.post.mock.calls[0];
expect(config.options?.deprecated).toMatchInlineSnapshot(`
expect(config.options?.deprecated).toMatchInlineSnapshot(
{
documentationUrl: expect.stringMatching(/#breaking-201550$/),
},
`
Object {
"documentationUrl": "https://www.elastic.co/guide/en/kibana/test-branch/breaking-changes-summary.html#breaking-201550",
"documentationUrl": StringMatching /#breaking-201550\\$/,
"reason": Object {
"newApiMethod": "POST",
"newApiPath": "/api/alerting/rule/{id}/_update_api_key",
"type": "migrate",
},
"severity": "warning",
}
`);
`
);
});
});

0 comments on commit 2ea6b1c

Please sign in to comment.