kibana/test/api_integration/apis/scripts/languages.js
Lukas Olson 13372c91ce
[data] Use versioned router for remaining routes (#161919)
## Summary

Uses the versioned router for the remaining routes in the data plugin:
KQL telemetry (opt-in stats), and scripting languages list.

### Checklist

- [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
2023-07-18 14:40:11 -07:00

39 lines
1.5 KiB
JavaScript

/*
* 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 expect from '@kbn/expect';
import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import { SCRIPT_LANGUAGES_ROUTE_LATEST_VERSION } from '@kbn/data-plugin/common/constants';
export default function ({ getService }) {
const supertest = getService('supertest');
describe('Script Languages API', function getLanguages() {
it('should return 200 with an array of languages', () =>
supertest
.get('/internal/scripts/languages')
.set(ELASTIC_HTTP_VERSION_HEADER, SCRIPT_LANGUAGES_ROUTE_LATEST_VERSION)
.expect(200)
.then((response) => {
expect(response.body).to.be.an('array');
}));
// eslint-disable-next-line jest/no-disabled-tests
it.skip('should only return langs enabled for inline scripting', () =>
supertest
.get('/internal/scripts/languages')
.set(ELASTIC_HTTP_VERSION_HEADER, SCRIPT_LANGUAGES_ROUTE_LATEST_VERSION)
.expect(200)
.then((response) => {
expect(response.body).to.contain('expression');
expect(response.body).to.contain('painless');
expect(response.body).to.not.contain('groovy');
}));
});
}