import * as messages from '@cucumber/messages' ; import IAstMaker from './IAstMaker' ; export default class AstMaker implements IAstMaker { public makeGherkinDocument ( uri , feature ) { return { uri , feature , comments : [ ] , } ; } public makeFeature ( line , keyword , name , description , children , tags ? ) { return { language : 'en' , location : { line } , keyword , name , description , children : children . slice ( ) , tags : tags ? tags . slice ( ) : undefined , } ; } public makeTag ( name , line ) { return { id : '123' , name , location : { line } , } ; } public makeScenarioFeatureChild ( id , line , keyword , name , description , steps , tags ) { return { scenario : { id , location : { line } , keyword , name , description , steps : steps . slice ( ) , tags : tags . slice ( ) , examples : [ ] , } , } ; } public makeBackgroundFeatureChild ( line , keyword , name , description , steps ) { return { background : { id : 'id' , location : { line } , keyword , name , description , steps : steps . map ( ( step ) => step ) , } , } ; } public makeStep ( id , line , keyword , text , docString ? , dataTable ? ) { return { id , location : { line } , keyword , text , docString , dataTable , } ; } public makeDocstring ( mediaType , content ) { return { mediaType , content , delimiter : '"""' , location : { line : 0 , column : 0 } , } ; } public makeDataTable ( cells ) { return { location : { line : 0 , column : 0 } , rows : cells . map ( ( row ) => ( { id : 'id' , location : { line : 0 , column : 0 } , cells : row . map ( ( cell ) => ( { location : { line : 0 , column : 0 } , value : cell , } ) ) , } ) ) , } ; } }