-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
LintRequest.test.ts
23 lines (20 loc) · 1.16 KB
/
LintRequest.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { describe, expect, test } from 'vitest';
import { getReporter } from '../cli-reporter.js';
import { LintRequest } from './LintRequest.js';
const oc = expect.objectContaining;
describe('LintRequest', () => {
test.each`
options | expected
${{}} | ${oc({ fileGlobs: [], files: undefined })}
${{ files: ['one\ntwo'] }} | ${oc({ fileGlobs: [], files: ['one', 'two'] })}
${{ file: ['one', 'two'], files: ['two'] }} | ${oc({ fileGlobs: [], files: ['one', 'two'] })}
${{ file: ['one', 'two'] }} | ${oc({ fileGlobs: [], files: ['one', 'two'] })}
${{ showContext: undefined }} | ${oc({ showContext: 0 })}
${{ showContext: true }} | ${oc({ showContext: 20 })}
${{ showContext: 3 }} | ${oc({ showContext: 3 })}
`('create LintRequest $options', ({ options, expected }) => {
const fileGlobs: string[] = [];
const request = new LintRequest(fileGlobs, options, getReporter({ fileGlobs }));
expect(request).toEqual(expected);
});
});