import { User } from '../authentication/types' ; import { GetService , AlertDef } from '../../types' ; import { getSpaceUrlPrefix } from '../authentication/spaces' ; export const createAlert = async ( getService , user , spaceId , alertDef ) => { const supertest = getService ( 'supertestWithoutAuth' ) ; const { body : response , status } = await supertest . post ( `${ getSpaceUrlPrefix ( spaceId ) }/api/alerts/alert` ) . auth ( user . username , user . password ) . send ( alertDef ) . set ( 'kbn-xsrf' , 'foo' ) ; return { alert : response , status } ; } ;