Skip to content

Commit

Permalink
chore: update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Jan 29, 2024
1 parent 1b9b34d commit 512f640
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"module": "./lib/index.js",
"exports": {
"types": "./lib/index.d.ts",
"import": "./lib/index.js",
"require": "./lib/index.cjs"
"require": "./lib/index.cjs",
"default": "./lib/index.js"
},
"types": "./lib/index.d.ts",
"files": [
Expand Down
10 changes: 9 additions & 1 deletion test/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ test('extractDataFromResponse', async () => {
expect(await extractDataFromResponse(new Response(), 'text')).toBe('')
expect(await extractDataFromResponse(new Response(null), 'text')).toBe('')
expect(await extractDataFromResponse(new Response('foo'), 'text')).toBe('foo')
expect(await extractDataFromResponse(new Response('foo'), 'json')).toBe('foo')
await expect(() =>
extractDataFromResponse(new Response('foo'), 'json'),
).rejects.toThrow(
// eslint-disable-next-line unicorn/better-regex, regexp/no-dupe-characters-character-class
/[SyntaxError: Unexpected token (('o', "foo" is not valid JSON)|(o in JSON at position 1))]/,

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'S' is
repeated in the same character class
.
Character 'S' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'n' is
repeated in the same character class
.
Character 'n' is
repeated in the same character class
.
Character 'n' is
repeated in the same character class
.
Character 'n' is
repeated in the same character class
.
Character 'n' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 't' is
repeated in the same character class
.
Character 't' is
repeated in the same character class
.
Character 't' is
repeated in the same character class
.
Character 't' is
repeated in the same character class
.
Character 't' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'a' is
repeated in the same character class
.
Character 'a' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'x' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'r' is
repeated in the same character class
.
Character 'r' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'o' is
repeated in the same character class
.
Character 'o' is
repeated in the same character class
.
Character 'o' is
repeated in the same character class
.
Character 'o' is
repeated in the same character class
.
Character 'o' is
repeated in the same character class
.
Character 'o' is
repeated in the same character class
.
Character 'o' is
repeated in the same character class
.
Character 'o' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.
Character ' ' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'e' is
repeated in the same character class
.
Character 'e' is
repeated in the same character class
.
Character 'e' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'p' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'd' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character '(' is
repeated in the same character class
.
Character '(' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character ''' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character '"' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'i' is
repeated in the same character class
.
Character 'i' is
repeated in the same character class
.
Character 'i' is
repeated in the same character class
.
Character 'i' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 's' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'J' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'O' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character 'N' is
repeated in the same character class
.

Check warning

Code scanning / CodeQL

Duplicate character in character class Warning test

Character ')' is
repeated in the same character class
.
Character ')' is
repeated in the same character class
.
)
expect(await extractDataFromResponse(new Response('foo'), 'json', true)).toBe(
'foo',
)
expect(
await extractDataFromResponse(new Response('{"foo":"bar"}'), 'json'),
).toEqual({ foo: 'bar' })
Expand Down

0 comments on commit 512f640

Please sign in to comment.