kprofileWrite.test.ts 936 B

12345678910111213141516171819202122
  1. /**
  2. * A K-profile write the printer did not acknowledge is reported as sent, not
  3. * as saved.
  4. */
  5. import { describe, it, expect } from 'vitest';
  6. import { kprofileWriteToast } from '../../utils/kprofileWrite';
  7. describe('kprofileWriteToast', () => {
  8. it('says saved when the printer confirmed it', () => {
  9. expect(kprofileWriteToast({ success: true, confirmed: true, message: '' }, 'kProfiles.toast.profileSaved'))
  10. .toEqual({ key: 'kProfiles.toast.profileSaved', type: 'success' });
  11. });
  12. it('warns when the printer did not confirm it', () => {
  13. expect(kprofileWriteToast({ success: true, confirmed: false, message: '' }, 'kProfiles.toast.profileSaved'))
  14. .toEqual({ key: 'kProfiles.toast.writeUnconfirmed', type: 'warning' });
  15. });
  16. it('keeps the old answer shape working', () => {
  17. expect(kprofileWriteToast({ success: true, message: '' }, 'kProfiles.toast.profileDeleted').type).toBe('success');
  18. });
  19. });