import expect from '@kbn/expect' ; import { FtrProviderContext } from '../../ftr_provider_context' ; export default function ( { getService } ) { 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 ) => { 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 ) => { 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 ) => { 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 ) => { 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 ) => { expect ( response . body ) . to . eql ( { message : 'Saved object [space/default] not found' , statusCode : 404 , error : 'Not Found' , } ) ; } ) ; } ) ; } ) ; } ) ; }