From f1be3af4bebe5749f8e99440688a685ceb898b2b Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Wed, 20 Apr 2022 18:21:20 +0900 Subject: [PATCH] chore: fixed typo --- src/context.test.ts | 4 ++-- src/hono.test.ts | 8 ++++---- src/hono.ts | 2 +- src/middleware/logger/index.test.ts | 2 +- src/middleware/logger/index.ts | 4 ++-- src/middleware/mustache/index.test.ts | 4 ++-- src/utils/body.test.ts | 2 +- src/utils/crypto.test.ts | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/context.test.ts b/src/context.test.ts index 6daad6b2..e56facb2 100644 --- a/src/context.test.ts +++ b/src/context.test.ts @@ -74,7 +74,7 @@ describe('Context', () => { expect(res.statusText).toBe('Created') }) - it('Complext pattern', async () => { + it('Complex pattern', async () => { c.status(404) const res = c.json({ hono: 'great app' }) expect(res.status).toBe(404) @@ -108,7 +108,7 @@ describe('Context', () => { expect(res.status).toBe(201) expect(await res.text()).toBe('this is body') - // res is already setted. + // res is already set. c.res = res c.header('X-Custom4', 'Message4') c.status(202) diff --git a/src/hono.test.ts b/src/hono.test.ts index eacaf32a..9982af26 100644 --- a/src/hono.test.ts +++ b/src/hono.test.ts @@ -118,7 +118,7 @@ describe('Routing', () => { const user = app.route('/user') user.get('/login', (c) => c.text('get /user/login')) - user.post('/regist', (c) => c.text('post /user/regist')) + user.post('/register', (c) => c.text('post /user/register')) let res = await app.request('http://localhost/book', { method: 'GET' }) expect(res.status).toBe(200) @@ -139,9 +139,9 @@ describe('Routing', () => { expect(res.status).toBe(200) expect(await res.text()).toBe('get /user/login') - res = await app.request('http://localhost/user/regist', { method: 'POST' }) + res = await app.request('http://localhost/user/register', { method: 'POST' }) expect(res.status).toBe(200) - expect(await res.text()).toBe('post /user/regist') + expect(await res.text()).toBe('post /user/register') }) }) @@ -193,7 +193,7 @@ describe('Middleware', () => { await next() }) - // Apeend Custom Header + // Append Custom Header app.use('*', async (c, next) => { await next() c.res.headers.append('x-custom', 'root') diff --git a/src/hono.ts b/src/hono.ts index bc1007b5..eea940f5 100644 --- a/src/hono.ts +++ b/src/hono.ts @@ -188,7 +188,7 @@ export class Hono { const wrappedHandler = async (context: Context, next: Next) => { const res = await handler(context) if (!(res instanceof Response)) { - throw new TypeError('response must be a instace of Response') + throw new TypeError('response must be a instance of Response') } context.res = res await next() diff --git a/src/middleware/logger/index.test.ts b/src/middleware/logger/index.test.ts index 09aa446b..6dab1198 100644 --- a/src/middleware/logger/index.test.ts +++ b/src/middleware/logger/index.test.ts @@ -45,7 +45,7 @@ describe('Logger by Middleware', () => { }) it('Log status 404', async () => { - const msg = 'Default 404 Nout Found' + const msg = 'Default 404 Not Found' app.all('*', (c) => { return c.text(msg, 404) }) diff --git a/src/middleware/logger/index.ts b/src/middleware/logger/index.ts index af60b9ed..95ce1876 100644 --- a/src/middleware/logger/index.ts +++ b/src/middleware/logger/index.ts @@ -42,13 +42,13 @@ function log( method: string, path: string, status?: number, - elasped?: string, + elapsed?: string, contentLength?: string ) { const out = prefix === LogPrefix.Incoming ? ` ${prefix} ${method} ${path}` - : ` ${prefix} ${method} ${path} ${colorStatus(status)} ${elasped} ${contentLength}` + : ` ${prefix} ${method} ${path} ${colorStatus(status)} ${elapsed} ${contentLength}` fn(out) } diff --git a/src/middleware/mustache/index.test.ts b/src/middleware/mustache/index.test.ts index d6cd1fc1..8e8f4b28 100644 --- a/src/middleware/mustache/index.test.ts +++ b/src/middleware/mustache/index.test.ts @@ -44,14 +44,14 @@ describe('Mustache by Middleware', () => { return c.render('index') }) - it('Mustache template redering', async () => { + it('Mustache template rendering', async () => { const req = new Request('http://localhost/foo') const res = await app.dispatch(req) expect(res.status).toBe(200) expect(await res.text()).toBe('Title: Hono!') }) - it('Mustache template redering with root', async () => { + it('Mustache template rendering with root', async () => { const req = new Request('http://localhost/bar') const res = await app.dispatch(req) expect(res.status).toBe(200) diff --git a/src/utils/body.test.ts b/src/utils/body.test.ts index 5665977f..7786f590 100644 --- a/src/utils/body.test.ts +++ b/src/utils/body.test.ts @@ -34,7 +34,7 @@ describe('Parse Body Middleware', () => { expect(await parseBody(req)).toEqual({ message: 'hello' }) }) - it('should parse Reponse body ', async () => { + it('should parse Response body ', async () => { const payload = 'hello' const res = new Response(payload, { headers: { diff --git a/src/utils/crypto.test.ts b/src/utils/crypto.test.ts index edf27577..7267649f 100644 --- a/src/utils/crypto.test.ts +++ b/src/utils/crypto.test.ts @@ -17,7 +17,7 @@ describe('crypto', () => { expect(await sha1('abcdedf')).not.toBe('abcdef') }) - it('encodeBaes64', () => { + it('encodeBase64', () => { expect(encodeBase64('hooooooooo')).toBe('aG9vb29vb29vbw==') expect(encodeBase64('炎')).toBe('54KO') expect(encodeBase64('abcdef')).not.toBe('abcdedf') @@ -27,7 +27,7 @@ describe('crypto', () => { }).toThrow(TypeError) }) - it('decodeBaes64', async () => { + it('decodeBase64', async () => { expect(decodeBase64('aG9vb29vb29vbw==')).toBe('hooooooooo') expect(decodeBase64('54KO')).toBe('炎') expect(decodeBase64('abcdedf')).not.toBe('abcdef')