Welcome to mirror list, hosted at ThFree Co, Russian Federation.

error_spec.js « utils « snippets « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 385554568dbf32db69ad5bf19abfeb0ac074e38b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { getErrorMessage, UNEXPECTED_ERROR } from '~/snippets/utils/error';

describe('~/snippets/utils/error', () => {
  describe('getErrorMessage', () => {
    it.each`
      input                                              | output
      ${null}                                            | ${UNEXPECTED_ERROR}
      ${'message'}                                       | ${'message'}
      ${new Error('test message')}                       | ${'test message'}
      ${{ networkError: 'Network error: test message' }} | ${'Network error: test message'}
      ${{}}                                              | ${UNEXPECTED_ERROR}
    `('with $input, should return "$output"', ({ input, output }) => {
      expect(getErrorMessage(input)).toBe(output);
    });
  });
});