Skip to content

Commit

Permalink
test: repo code to cover new lint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Jun 13, 2020
1 parent 94f8c63 commit 6831920
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions packages/querystring/__tests__/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,19 @@ describe('Standard Behaviour', () => {
describe('Error checking', () => {
test('should work with wrong options', () => {
const expected = { prop: 'value', prop2: 'value2' };
// @ts-expect-error
// @ts-expect-error This is testing TS-invalid code that is handled in JS
expect(parse('?prop%value&prop2%value2', { seperator: '&', equals: '%' })).toMatchObject(expected);
});

test('should error with wrong input', () => {
// @ts-expect-error
// @ts-expect-error This is testing TS-invalid code that is handled in JS
expect(() => parse({ prop: 'value', prop2: 'value2' })).toThrowError(
'@Favware/Querystring: Your input was not an string. Please supply a string when using Parse.'
);
});

test('should work when passing invalid separator and equals', () => {
const expected = { prop: 'value', prop2: 'value2' };
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore ts-expect-error doesn't recognize this as a valid usecase yet
const actual = parse('?prop=value&prop2=value2', { separator: null, equals: null });
expect(actual).toMatchSnapshot();
Expand Down
3 changes: 1 addition & 2 deletions packages/querystring/__tests__/stringify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('Error checking', () => {
const expected = 'prop%value=prop2%value2';
const actual = stringify(
{ prop: 'value', prop2: 'value2' },
// @ts-expect-error
// @ts-expect-error This is testing TS-invalid code that is handled in JS
{ separator: '=', equals: '%', includeQeustion: true }
);
expect(actual).toMatchSnapshot();
Expand All @@ -93,7 +93,6 @@ describe('Error checking', () => {
const expected = '?propnullvaluenullprop2nullvalue2';
const actual = stringify(
{ prop: 'value', prop2: 'value2' },
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore ts-expect-error doesn't recognize this as a valid usecase yet
{ separator: null, equals: null, includeQuestion: true }
);
Expand Down

1 comment on commit 6831920

@vercel
Copy link

@vercel vercel bot commented on 6831920 Jun 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.