0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-21 18:18:57 +01:00

refactor: fix typos (#3583)

This commit is contained in:
mattn 2024-10-30 09:44:06 +09:00 committed by GitHub
parent 3af317f0ef
commit e9de50d7c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 16 additions and 16 deletions

View File

@ -2,7 +2,7 @@ import { assertEquals } from '@std/assert'
import { stream, streamSSE } from '../../src/helper/streaming/index.ts' import { stream, streamSSE } from '../../src/helper/streaming/index.ts'
import { Hono } from '../../src/hono.ts' import { Hono } from '../../src/hono.ts'
Deno.test('Shuld call onAbort via stream', async () => { Deno.test('Should call onAbort via stream', async () => {
const app = new Hono() const app = new Hono()
let aborted = false let aborted = false
app.get('/stream', (c) => { app.get('/stream', (c) => {
@ -34,7 +34,7 @@ Deno.test('Shuld call onAbort via stream', async () => {
await server.shutdown() await server.shutdown()
}) })
Deno.test('Shuld not call onAbort via stream if already closed', async () => { Deno.test('Should not call onAbort via stream if already closed', async () => {
const app = new Hono() const app = new Hono()
let aborted = false let aborted = false
app.get('/stream', (c) => { app.get('/stream', (c) => {
@ -54,7 +54,7 @@ Deno.test('Shuld not call onAbort via stream if already closed', async () => {
await server.shutdown() await server.shutdown()
}) })
Deno.test('Shuld call onAbort via streamSSE', async () => { Deno.test('Should call onAbort via streamSSE', async () => {
const app = new Hono() const app = new Hono()
let aborted = false let aborted = false
app.get('/stream', (c) => { app.get('/stream', (c) => {
@ -87,7 +87,7 @@ Deno.test('Shuld call onAbort via streamSSE', async () => {
await server.shutdown() await server.shutdown()
}) })
Deno.test('Shuld not call onAbort via streamSSE if already closed', async () => { Deno.test('Should not call onAbort via streamSSE if already closed', async () => {
const app = new Hono() const app = new Hono()
let aborted = false let aborted = false
app.get('/stream', (c) => { app.get('/stream', (c) => {

View File

@ -106,7 +106,7 @@ describe('Cookie Middleware', () => {
expect(res.headers.get('Fortune-Cookie')).toBe('lots-of-money') expect(res.headers.get('Fortune-Cookie')).toBe('lots-of-money')
}) })
it('Get signed cookie witn invalid signature', async () => { it('Get signed cookie with invalid signature', async () => {
const req = new Request('http://localhost/cookie-signed-get-one') const req = new Request('http://localhost/cookie-signed-get-one')
// fortune_cookie has invalid signature // fortune_cookie has invalid signature
const cookieString = const cookieString =

View File

@ -381,8 +381,8 @@ export const toSSG: ToSSGInterface = async (app, fs, options) => {
result = { success: false, files: [], error: errorObj } result = { success: false, files: [], error: errorObj }
} }
if (options?.afterGenerateHook) { if (options?.afterGenerateHook) {
const conbinedAfterGenerateHooks = combineAfterGenerateHooks(options?.afterGenerateHook) const combinedAfterGenerateHooks = combineAfterGenerateHooks(options?.afterGenerateHook)
await conbinedAfterGenerateHooks(result) await combinedAfterGenerateHooks(result)
} }
return result return result
} }

View File

@ -9,8 +9,8 @@ import { findTargetHandler, isMiddleware } from '../../utils/handler'
* @returns Parent dir path * @returns Parent dir path
*/ */
export const dirname = (path: string): string => { export const dirname = (path: string): string => {
const splittedPath = path.split(/[\/\\]/) const separatedPath = path.split(/[\/\\]/)
return splittedPath.slice(0, -1).join('/') // Windows supports slash path return separatedPath.slice(0, -1).join('/') // Windows supports slash path
} }
const normalizePath = (path: string): string => { const normalizePath = (path: string): string => {

View File

@ -57,7 +57,7 @@ export type HonoOptions<E extends Env> = {
*/ */
strict?: boolean strict?: boolean
/** /**
* `router` option specifices which router to use. * `router` option specifies which router to use.
* *
* @see {@link https://hono.dev/docs/api/hono#router-option} * @see {@link https://hono.dev/docs/api/hono#router-option}
* *

View File

@ -159,7 +159,7 @@ describe('render to string', () => {
expect(template.toString()).toBe('<p><span>a</span><span>b</span></p>') expect(template.toString()).toBe('<p><span>a</span><span>b</span></p>')
}) })
it('Empty elements are rended withtout closing tag', () => { it('Empty elements are rended without closing tag', () => {
const template = <input /> const template = <input />
expect(template.toString()).toBe('<input/>') expect(template.toString()).toBe('<input/>')
}) })

View File

@ -48,16 +48,16 @@ const buildMatcher = (
functionRules.push(rule) functionRules.push(rule)
} else { } else {
if (IS_CIDR_NOTATION_REGEX.test(rule)) { if (IS_CIDR_NOTATION_REGEX.test(rule)) {
const splittedRule = rule.split('/') const separatedRule = rule.split('/')
const addrStr = splittedRule[0] const addrStr = separatedRule[0]
const type = distinctRemoteAddr(addrStr) const type = distinctRemoteAddr(addrStr)
if (type === undefined) { if (type === undefined) {
throw new TypeError(`Invalid rule: ${rule}`) throw new TypeError(`Invalid rule: ${rule}`)
} }
const isIPv4 = type === 'IPv4' const isIPv4 = type === 'IPv4'
const prefix = parseInt(splittedRule[1]) const prefix = parseInt(separatedRule[1])
if (isIPv4 ? prefix === 32 : prefix === 128) { if (isIPv4 ? prefix === 32 : prefix === 128) {
// this rule is a static rule // this rule is a static rule

View File

@ -28,7 +28,7 @@ describe('Get with *', () => {
}) })
}) })
describe('Get with * inclusing JS reserved words', () => { describe('Get with * including JS reserved words', () => {
const node = new Node() const node = new Node()
node.insert('get', '*', 'get all') node.insert('get', '*', 'get all')
it('get /', () => { it('get /', () => {

View File

@ -16,7 +16,7 @@ describe('expandIPv6', () => {
}) })
}) })
describe('distinctRemoteAddr', () => { describe('distinctRemoteAddr', () => {
it('Should result be valud', () => { it('Should result be valid', () => {
expect(distinctRemoteAddr('1::1')).toBe('IPv6') expect(distinctRemoteAddr('1::1')).toBe('IPv6')
expect(distinctRemoteAddr('::1')).toBe('IPv6') expect(distinctRemoteAddr('::1')).toBe('IPv6')