Blame view

天文台pc/tianwentai-ui/node_modules/react-day-picker/src/contexts/Modifiers/utils/matcherToArray.test.ts 774 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  import { matcherToArray } from 'contexts/Modifiers/utils/matcherToArray';
  import { Matcher } from 'types/Matchers';
  
  const matcher: Matcher = jest.fn();
  
  describe('when a Matcher is passed in', () => {
    test('should return an array with the Matcher', () => {
      expect(matcherToArray(matcher)).toStrictEqual([matcher]);
    });
  });
  
  describe('when an array of Matchers is passed in', () => {
    test('should return a copy of the array', () => {
      const value = [matcher, matcher];
      const result = matcherToArray(value);
      expect(result).toStrictEqual(value);
      expect(result).not.toBe(value);
    });
  });
  
  describe('when undefined is passed in', () => {
    test('should return an empty array', () => {
      expect(matcherToArray(undefined)).toStrictEqual([]);
    });
  });