import { Diff } from '../Diff' ; import { Result } from 'defekt' ; const unequalValueResultDiffSymbol = Symbol ( 'unequal value result diff' ) ; const unequalErrorResultDiffSymbol = Symbol ( 'unequal error result diff' ) ; const expectedValueGotErrorResultDiffSymbol = Symbol ( 'expected value got error result diff' ) ; const expectedErrorGotValueResultDiffSymbol = Symbol ( 'expected error got value result diff' ) ; const unequalValueResultDiff = function ( parameters ) : UnequalValueResultDiff { return { kind : unequalValueResultDiffSymbol , ... parameters } ; } ; const unequalErrorResultDiff = function ( parameters ) : UnequalErrorResultDiff { return { kind : unequalErrorResultDiffSymbol , ... parameters } ; } ; const expectedValueGotErrorResultDiff = function ( parameters ) : ExpectedValueGotErrorResultDiff { return { kind : expectedValueGotErrorResultDiffSymbol , ... parameters } ; } ; const expectedErrorGotValueResultDiff = function ( parameters ) : ExpectedErrorGotValueResultDiff { return { kind : expectedErrorGotValueResultDiffSymbol , ... parameters } ; } ; interface UnequalValueResultDiff extends Diff { kind : typeof unequalValueResultDiffSymbol ; diff : Diff ; } interface UnequalErrorResultDiff extends Diff { kind : typeof unequalErrorResultDiffSymbol ; diff : Diff ; } interface ExpectedValueGotErrorResultDiff extends Diff { kind : typeof expectedValueGotErrorResultDiffSymbol ; actual : Result < any , any > ; expected : Result < any , any > ; } interface ExpectedErrorGotValueResultDiff extends Diff { kind : typeof expectedErrorGotValueResultDiffSymbol ; actual : Result < any , any > ; expected : Result < any , any > ; } type ResultDiff = UnequalValueResultDiff | UnequalErrorResultDiff | ExpectedValueGotErrorResultDiff | ExpectedErrorGotValueResultDiff ; const isUnequalValueResultDiff = function ( diff ) : diff is UnequalValueResultDiff { return 'kind' in diff && diff . kind === unequalValueResultDiffSymbol ; } ; const isUnequalErrorResultDiff = function ( diff ) : diff is UnequalErrorResultDiff { return 'kind' in diff && diff . kind === unequalErrorResultDiffSymbol ; } ; const isExpectedValueGotErrorResultDiff = function ( diff ) : diff is ExpectedValueGotErrorResultDiff { return 'kind' in diff && diff . kind === expectedValueGotErrorResultDiffSymbol ; } ; const isExpectedErrorGotValueResultDiff = function ( diff ) : diff is ExpectedErrorGotValueResultDiff { return 'kind' in diff && diff . kind === expectedErrorGotValueResultDiffSymbol ; } ; const isResultDiff = function ( diff ) : diff is ResultDiff { return isUnequalValueResultDiff ( diff ) || isUnequalErrorResultDiff ( diff ) || isExpectedValueGotErrorResultDiff ( diff ) || isExpectedErrorGotValueResultDiff ( diff ) ; } ; export type { ExpectedValueGotErrorResultDiff , ExpectedErrorGotValueResultDiff , ResultDiff , UnequalValueResultDiff , UnequalErrorResultDiff } ; export { expectedErrorGotValueResultDiff , expectedValueGotErrorResultDiff , isExpectedValueGotErrorResultDiff , isExpectedErrorGotValueResultDiff , isResultDiff , isUnequalErrorResultDiff , isUnequalValueResultDiff , unequalErrorResultDiff , unequalValueResultDiff } ;