All files mod_test.ts

100% Statements 29/29
100% Branches 0/0
100% Functions 2/2
100% Lines 28/28

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 26 27 28 29 30 31 32 33 34 351x 1x 1x 1x 1x 1x   1x   1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x      
import * as path from 'path';
import {listToArray, Quotes, Declaration} from './mod';
import * as chai from 'chai';
import * as chaiJestSnapshot from 'chai-jest-snapshot';
chai.use(chaiJestSnapshot);
const {expect} = chai;
 
const F = path.join('src/snapshots', `${path.basename(__filename)}.js`);
 
describe('listToArray', () => {
  it('should test cli', async () => {
    expect(listToArray('')).to.matchSnapshot(F, 'E');
    expect(listToArray('hello')).to.matchSnapshot(F, 'S');
    expect(listToArray('hello\nworld')).to.matchSnapshot(F, 'D');
 
    const __tick = {quotes: Quotes.backtick};
    const __single = {quotes: Quotes.single};
    const __double = {quotes: Quotes.double};
    expect(listToArray('hello', __tick)).to.matchSnapshot(F, 'T_S');
    expect(listToArray('hello\nworld', __tick)).to.matchSnapshot(F, 'T_D');
    expect(listToArray('hello', __single)).to.matchSnapshot(F, 'S_S');
    expect(listToArray('hello\nworld', __single)).to.matchSnapshot(F, 'S_D');
    expect(listToArray('hello', __double)).to.matchSnapshot(F, 'D_S');
    expect(listToArray('hello\nworld', __double)).to.matchSnapshot(F, 'D_D');
 
    const name = 'name';
    const __var = {name, declaration: Declaration.var};
    const __const = {name, declaration: Declaration.const};
    const __let = {name, declaration: Declaration.let};
    expect(listToArray('hello\nworld', __var)).to.matchSnapshot(F, 'V');
    expect(listToArray('hello\nworld', __const)).to.matchSnapshot(F, 'C');
    expect(listToArray('hello\nworld', __let)).to.matchSnapshot(F, 'L');
  });
});