kibana/x-pack/test/api_integration/apis/spaces/saved_objects.ts
Tiago Costa 1972311f6f
fix(NA): windows ts_project outside sandbox compilation (#100947) (#101305)
* fix(NA): windows ts_project outside sandbox compilation adding tsconfig paths for packages

* chore(NA): missing @kbn paths for node_modules so types can work

* chore(NA): missing @kbn paths for node_modules so types can work

* chore(NA): organizing deps on non ts_project packages

* chore(NA): change order to find @kbn packages on node_modules first

* chore(NA): add @kbn/expect typings setting on package.json

* chore(NA): fix typechecking

* chore(NA): add missing change on tsconfig file

* chore(NA): unblock windows build by not depending on the pkg_npm rule symlink in the package.json

* chore(NA): add missing depedencies on BUILD.bazel file for io-ts-list-types

* chore(NA): remove rootDirs configs

* chore(NA): change kbn/monaco targets order

* chore(NA): update kbn-monaco build

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
# Conflicts:
#	package.json
2021-06-03 14:53:36 -04:00

101 lines
3.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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import expect from '@kbn/expect/expect';
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
describe('`space` saved object type', () => {
describe('GET /api/saved_objects/space/default', () => {
it('should not return the default space', async () => {
await supertest
.get('/api/saved_objects/space/default')
.set('kbn-xsrf', 'xxx')
.send()
.expect(404)
.then((response: Record<string, any>) => {
expect(response.body).to.eql({
message: `Saved object [space/default] not found`,
statusCode: 404,
error: 'Not Found',
});
});
});
});
describe('GET /api/saved_objects/_find?type=space', () => {
it('should not locate any spaces', async () => {
await supertest
.get('/api/saved_objects/_find?type=space')
.set('kbn-xsrf', 'xxx')
.send()
.expect(200)
.then((response: Record<string, any>) => {
expect(response.body).to.eql({
page: 1,
per_page: 20,
total: 0,
saved_objects: [],
});
});
});
});
describe('POST /api/saved_objects/space/my-space', () => {
it('should not allow a space to be created', async () => {
await supertest
.post('/api/saved_objects/space/my-space')
.set('kbn-xsrf', 'xxx')
.send({ attributes: {} })
.expect(400)
.then((response: Record<string, any>) => {
expect(response.body).to.eql({
message: "Unsupported saved object type: 'space': Bad Request",
statusCode: 400,
error: 'Bad Request',
});
});
});
});
describe('PUT /api/saved_objects/space/default', () => {
it('should not allow a space to be updated', async () => {
await supertest
.post('/api/saved_objects/space/default')
.set('kbn-xsrf', 'xxx')
.send({ attributes: {} })
.expect(400)
.then((response: Record<string, any>) => {
expect(response.body).to.eql({
message: "Unsupported saved object type: 'space': Bad Request",
statusCode: 400,
error: 'Bad Request',
});
});
});
});
describe('DELETE /api/saved_objects/space/default', () => {
it('should not allow a space to be deleted', async () => {
await supertest
.delete('/api/saved_objects/space/default')
.set('kbn-xsrf', 'xxx')
.send()
.expect(404)
.then((response: Record<string, any>) => {
expect(response.body).to.eql({
message: 'Saved object [space/default] not found',
statusCode: 404,
error: 'Not Found',
});
});
});
});
});
}