getAmsLabel.test.ts 820 B

12345678910111213141516171819202122232425
  1. import { describe, it, expect } from 'vitest';
  2. import { getAmsLabel } from '../../utils/amsHelpers';
  3. describe('getAmsLabel', () => {
  4. it('labels regular AMS units A/B/C by id', () => {
  5. expect(getAmsLabel(0, 4)).toBe('AMS-A');
  6. expect(getAmsLabel(1, 4)).toBe('AMS-B');
  7. });
  8. it('labels AMS-HT units (single tray, id >= 128)', () => {
  9. expect(getAmsLabel(128, 1)).toBe('HT-A');
  10. expect(getAmsLabel(129, 1)).toBe('HT-B');
  11. });
  12. it('labels the external spool', () => {
  13. expect(getAmsLabel(255, 1)).toBe('External');
  14. });
  15. it('labels the A2L AMS Lite (normalised unit id 6) distinctly', () => {
  16. // The backend normalises the A2L Lite's physical unit 16 -> 6; no regular
  17. // AMS uses id 6, so it never collides with the A/B/C range.
  18. expect(getAmsLabel(6, 4)).toBe('AMS Lite');
  19. });
  20. });