import { matcherHint , printReceived , printExpected } from "jest-matcher-utils" ; import { Sequence } from '../sequence' ; import predicate from "./predicate" ; const passMessage = ( received , expected ) => ( ) => matcherHint ( '.not.toStartWithSequenceAsync' ) + `\n\n` + `Expected sequence to not start with:\n  ${ printExpected ( expected ) }\n` + `Received:\n  ${ printReceived ( received ) }` ; const failMessage = ( received , expected ) => ( ) => matcherHint ( '.toStartWithSequenceAsync' ) + `\n\n` + `Expected sequence to start with:\n  ${ printExpected ( expected ) }\n` + `Received:\n  ${ printReceived ( received ) }` ; export async function toStartWithSequenceAsync < T > ( received , expected ) { const result = await predicate ( received , expected ) ; return { pass : result . pass , message : ( result . pass ? passMessage : failMessage ) ( result . received , result . expected ) } ; }