import { RequestOptions , ResponseOptions } from '@pact-foundation/pact' ; import { eachLike } from '@pact-foundation/pact/src/dsl/matchers' ; import { StorageItem , StorageItemMetaData } from './storage/storage-item' ; export const exampleStorageItemMetaData = { id : 2 , timestamp : 'some date' , pipelineId : 1 , } ; export const exampleStorageItem = { ... exampleStorageItemMetaData , data : { } , } ; export function getStoredItemsRequestTitle ( pipelineId ) { return `a request for getting all stored items of the pipeline with id ${ pipelineId }` ; } export function getStoredItemsRequest ( pipelineId ) { return { method : 'GET' , path : `/${ pipelineId }` , query : 'select=id,timestamp,pipelineId' , headers : { 'Content-Type' : 'application/json' , } , } ; } export const getStoredItemsSuccessResponse = { status : 200 , headers : { 'Content-Type' : 'application/json; charset=utf-8' , } , body : eachLike ( exampleStorageItemMetaData ) , } ; export const getStoredItemsEmptySuccessResponse = { status : 200 , headers : { 'Content-Type' : 'application/json; charset=utf-8' , } , body : [ ] , } ; export function getStoredItemRequestTitle ( pipelineId , storageItemId ) { return `a request for getting the stored item with id ${ storageItemId } of the pipeline with id ${ pipelineId }` ; } export function getStoredItemRequest ( pipelineId , storageItemId ) { return { method : 'GET' , path : `/${ pipelineId }` , query : `id=eq.${ storageItemId }` , headers : { 'Content-Type' : 'application/json' , } , } ; } export const getStoredItemSuccessResponse = { status : 200 , headers : { 'Content-Type' : 'application/json; charset=utf-8' , } , body : eachLike ( exampleStorageItem ) , } ; export const getStoredItemEmptySuccessResponse = { status : 200 , headers : { 'Content-Type' : 'application/json; charset=utf-8' , } , body : [ ] , } ; export const notFoundResponse = { status : 404 , } ; export const badRequestResponse = { status : 400 , } ;