Skip to content
Prev Previous commit
Next Next commit
Add test for getLabelPrinter
  • Loading branch information
pedrottimark committed Oct 15, 2018
commit 8e11f7ff8465efffa52becf8d07cb7c45c0da9d7
8 changes: 8 additions & 0 deletions packages/jest-matcher-utils/src/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ describe('getLabelPrinter', () => {
expect(printLabel(stringExpected)).toBe('Expected value: ');
expect(printLabel(stringReceived)).toBe('Received set: ');
});
test('returns incorrect padding if inconsistent arg is shorter', () => {
const stringConsistent = 'Expected';
const stringInconsistent = 'Received value';
const stringInconsistentShorter = 'Received set';
const printLabel = getLabelPrinter(stringConsistent, stringInconsistent);
expect(printLabel(stringConsistent)).toBe('Expected: ');
expect(printLabel(stringInconsistentShorter)).toBe('Received set: ');
});
test('throws if inconsistent arg is longer', () => {
const stringConsistent = 'Expected';
const stringInconsistent = 'Received value';
Expand Down