text: const intersperse = require('../');
  
  describe('intersperse', () => {
    it('should insert string into string', () => {
      const expected = 'A,B,C,D,E,F';
      expect(intersperse(',', 'ABCDEF')).toEqual(expected);
    });
  
    it('should insert string into number array', () => {
      const expected = [1, '/', 2, '/', 3];
      expect(intersperse('/', [1, 2, 3])).toEqual(expected);
    });
    it('should insert a object', () => {
      const obj = {
        a: 'A',
      };
      expected = [1, obj, 2, obj, 3];
      expect(intersperse(obj, [1, 2, 3])).toEqual(expected);
    });
  
    describe('should insert a value generated by a function argument', () => {
      it('should insert number', () => {
        const expected = [1, 3, 2, 5, 3];
        expect(
          intersperse(
            (prev, next) => {
              return prev + next;
            },
            [1, 2, 3]
          )
        ).toEqual(expected);
      });
  
      it('should insert string', () => {
        const expected = ['a', 'ab', 'b', 'bc', 'c'];
        expect(
          intersperse(
            (prev, next) => {
              return prev + next;
            },
            ['a', 'b', 'c']
          )
        ).toEqual(expected);
      });
  
      it('should return an empty array', () => {
        expect(
          intersperse((prev, next) => {
            return prev + next;
          }, [])
        ).toEqual([]);
      });
    });
  
    it('should return an empty array when passing array is empty', () => {
      const expected = [];
      expect(intersperse('/', [])).toEqual(expected);
    });
  });
  