import { FunctionCallData , ScriptData } from 'js-yaml-loader!@/*' ; import { RecommendationLevel } from '@/domain/RecommendationLevel' ; import { FunctionCallDataStub } from '@tests/unit/stubs/FunctionCallDataStub' ; export class ScriptDataStub implements ScriptData { public static createWithCode ( ) { return new ScriptDataStub ( ) . withCode ( 'stub-code' ) . withRevertCode ( 'stub-revert-code' ) ; } public static createWithCall ( call ? ) { let instance = new ScriptDataStub ( ) ; if ( call ) { instance = instance . withCall ( call ) ; } else { instance = instance . withMockCall ( ) ; } return instance ; } public static createWithoutCallOrCodes ( ) { return new ScriptDataStub ( ) ; } public name = 'valid-name' ; public code = undefined ; public revertCode = undefined ; public call = undefined ; public recommend = RecommendationLevel [ RecommendationLevel . Standard ] . toLowerCase ( ) ; public docs = [ 'hello.com' ] ; private constructor ( ) { } public withName ( name ) { this . name = name ; return this ; } public withDocs ( docs ) { this . docs = docs ; return this ; } public withCode ( code ) { this . code = code ; return this ; } public withRevertCode ( revertCode ) { this . revertCode = revertCode ; return this ; } public withMockCall ( ) { this . call = new FunctionCallDataStub ( ) ; return this ; } public withCall ( call ) { this . call = call ; return this ; } public withRecommend ( recommend ) { this . recommend = recommend ; return this ; } public withRecommendationLevel ( level ) { this . recommend = RecommendationLevel [ level ] . toLowerCase ( ) ; return this ; } }