assertthat
Version:
assertthat provides fluent TDD.
22 lines (18 loc) • 529 B
text/typescript
import { AssertionFailed } from '../../errors';
import { dispel } from '../../dispel/dispel';
import { prettyPrint } from '../../prettyPrint/typeAware/prettyPrint';
import { error, Result, value } from 'defekt';
const assertAnyIsUndefined = function (
actual: any
): Result<undefined, AssertionFailed> {
if (actual === undefined) {
return value();
}
return error(new AssertionFailed({
message: 'The value is not undefined.',
actual: prettyPrint(dispel(actual))
}));
};
export {
assertAnyIsUndefined
};