Skip to content

Commit

Permalink
test: add test for appendParams and create http error
Browse files Browse the repository at this point in the history
  • Loading branch information
fzn0x committed Jun 18, 2024
1 parent 7ea3b6e commit 4ce39ee
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion browser/hyperfetch-browser.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion browser/hyperfetch-browser.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InitOptions } from './types/init.js'
import type { InitOptions } from './types/init.js'
import type { HttpRequestFunctions } from './types/request.js'

import { getAbortController } from './utils/get-abort-controller.js'
Expand Down
10 changes: 10 additions & 0 deletions src/utils/append-params.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { appendParams } from './append-params.js'

describe('appendParams', () => {
it('working', async () => {
const params = appendParams('http://localhost', {
hello: 'world',
})
expect(params).equals('http://localhost/?hello=world')
})
})
8 changes: 8 additions & 0 deletions src/utils/create-http-error.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createHTTPError } from './create-http-error.js'

describe('createHTTPError', () => {
it('working', async () => {
const params = createHTTPError(new Response(), new Response())
expect(params.message).equals('status code 200')
})
})
6 changes: 3 additions & 3 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// vitest.config.ts
import { defineConfig } from "vitest/config";
import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
include: ["**/src/*.test.ts"],
include: ['**/src/**/*.test.ts'],
globals: true,
},
});
})

0 comments on commit 4ce39ee

Please sign in to comment.