/* eslint-env jest */ import { revertMessage } from '../revert-message'; describe('what an undo tells the merchant', () => { it('counts what went back', () => { expect(revertMessage(1)).toBe('One change put back.'); expect(revertMessage(6, 0)).toBe('6 changes put back.'); }); it('says which edits were kept', () => { expect(revertMessage(4, 2)).toBe( '4 changes put back. 2 fields were edited after the automation wrote them and keep those edits.' ); }); }); describe('an undo on pages deleted since', () => { it('says there was nothing to put back', () => { expect(revertMessage(0, 0, 4)).toBe( '0 changes put back. 4 changes were on pages deleted since, so there is nothing to put back.' ); expect(revertMessage(2, 1, 1)).toBe( '2 changes put back. One field was edited after the automation wrote it and keeps that edit. One change was on a page deleted since, so there is nothing to put back.' ); }); });