mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
## Summary Partially resolves https://github.com/elastic/kibana/issues/150392 This PR creates reporting related packages geared towards `Generate CSV` functionality - @kbn/generate-csv - @kbn/generate-csv-types - @kbn/reporting-common - updated Readme.md for the @kbn/reporting plugin ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Tim Sullivan <tsullivan@users.noreply.github.com> Co-authored-by: Timothy Sullivan <tsullivan@elastic.co>
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
* Side Public License, v 1.
|
|
*/
|
|
|
|
import * as errors from './errors';
|
|
|
|
const { ReportingError: _, ...nonAbstractErrors } = errors;
|
|
|
|
describe('Reporting error', () => {
|
|
it('provides error code when stringified', () => {
|
|
expect(new errors.AuthenticationExpiredError() + '').toBe(
|
|
`ReportingError(code: authentication_expired_error)`
|
|
);
|
|
});
|
|
it('provides details if there are any and error code when stringified', () => {
|
|
expect(new errors.AuthenticationExpiredError('some details') + '').toBe(
|
|
`ReportingError(code: authentication_expired_error) "some details"`
|
|
);
|
|
});
|
|
it('has the expected error code structure', () => {
|
|
Object.values(nonAbstractErrors).forEach((Ctor) => {
|
|
expect(Ctor.code).toMatch(/^[a-z_]+_error$/);
|
|
});
|
|
});
|
|
it('has the same error code values on static "code" and instance "code" properties', () => {
|
|
Object.values(nonAbstractErrors).forEach((Ctor) => {
|
|
expect(Ctor.code).toBe(new Ctor().code);
|
|
});
|
|
});
|
|
});
|