declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
26 lines • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const checkContainsSubstring_1 = require("./checkContainsSubstring");
describe('checkContainsSubstring', () => {
it('should return nothing when the string is a substring', () => {
const result = (0, checkContainsSubstring_1.checkContainsSubstring)({
declaredContents: 'a-substring',
foundContents: 'a-big-string with a-substring inside',
});
expect(result).not.toBeDefined();
});
it('should throw an error with a good looking diff when not equal', () => {
try {
(0, checkContainsSubstring_1.checkContainsSubstring)({
declaredContents: 'a-substring',
foundContents: 'a-big-string with a-different-substring inside',
});
fail('should not reach here');
}
catch (error) {
expect(error.message).toContain('toContain');
expect(error.message).toMatchSnapshot(); // log example of it
}
});
});
//# sourceMappingURL=checkContainsSubstring.test.js.map