github.com/argoproj/argo-cd@v1.8.7/ui/src/app/applications/components/application-parameters/kustomize-image.test.ts (about)

     1  import { format, parse } from './kustomize-image';
     2  
     3  test('parse image version override', () => {
     4      const image = parse('foo/bar:v1.0.0');
     5  
     6      expect(image.name).toBe('foo/bar');
     7      expect(image.newTag).toBe('v1.0.0');
     8  });
     9  
    10  test('format image version override', () => {
    11      const formatted = format({ name: 'foo/bar', newTag: 'v1.0.0' });
    12      expect(formatted).toBe('foo/bar:v1.0.0');
    13  });
    14  
    15  test('parse image name override', () => {
    16      const image = parse('foo/bar=foo/bar1:v1.0.0');
    17  
    18      expect(image.name).toBe('foo/bar');
    19      expect(image.newName).toBe('foo/bar1');
    20      expect(image.newTag).toBe('v1.0.0');
    21  });
    22  
    23  test('format image name override', () => {
    24      const formatted = format({ name: 'foo/bar', newTag: 'v1.0.0', newName: 'foo/bar1' });
    25      expect(formatted).toBe('foo/bar=foo/bar1:v1.0.0');
    26  });
    27  
    28  test('parse image digest override', () => {
    29      const image = parse('foo/bar@sha:123');
    30  
    31      expect(image.name).toBe('foo/bar');
    32      expect(image.digest).toBe('sha:123');
    33  });
    34  
    35  test('format image digest override', () => {
    36      const formatted = format({ name: 'foo/bar', digest: 'sha:123' });
    37      expect(formatted).toBe('foo/bar@sha:123');
    38  });