queueBulkUpdate.test.ts 880 B

123456789101112131415161718192021222324252627
  1. /**
  2. * A queue bulk edit said only "Updated N items" in a neutral toast, also when
  3. * it updated none of them.
  4. */
  5. import { describe, it, expect } from 'vitest';
  6. import { bulkUpdateToast } from '../../utils/queueBulkUpdate';
  7. describe('bulkUpdateToast', () => {
  8. it('is an error when nothing was updated', () => {
  9. expect(bulkUpdateToast({ updated_count: 0, skipped_count: 3 })).toMatchObject({
  10. key: 'queue.toast.bulkUpdatedNone',
  11. type: 'error',
  12. });
  13. });
  14. it('is a warning when some were skipped', () => {
  15. expect(bulkUpdateToast({ updated_count: 2, skipped_count: 1 })).toEqual({
  16. key: 'queue.toast.bulkUpdatedSome',
  17. params: { updated: 2, skipped: 1 },
  18. type: 'warning',
  19. });
  20. });
  21. it('is a success when all were updated', () => {
  22. expect(bulkUpdateToast({ updated_count: 4, skipped_count: 0 }).type).toBe('success');
  23. });
  24. });