Skip to content

Commit 730dfc5

Browse files
committed
fix type error in logging unit tests
1 parent 078108c commit 730dfc5

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/event-handler/tests/unit/rest/BaseRouter.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import context from '@aws-lambda-powertools/testing-utils/context';
22
import type { Context } from 'aws-lambda';
33
import { beforeEach, describe, expect, it, vi } from 'vitest';
44
import { BaseRouter } from '../../../src/rest/BaseRouter.js';
5+
import { HttpVerbs } from '../../../src/rest/constatnts.js';
56
import type { ResolveOptions } from '../../../src/types/index.js';
67
import type {
78
HttpMethod,
@@ -81,8 +82,8 @@ describe('Class: BaseRouter', () => {
8182
it('uses the global console when no logger is not provided', () => {
8283
// Act
8384
const app = new TestResolver();
84-
app.route(() => true, { path: '/', method: 'get' });
85-
85+
app.route(() => true, { path: '/', method: HttpVerbs.GET });
86+
8687
// Assess
8788
expect(console.debug).not.toHaveBeenCalled();
8889
expect(console.error).toHaveBeenCalledWith('test error');
@@ -92,11 +93,11 @@ describe('Class: BaseRouter', () => {
9293
it('emits debug logs using global console when the log level is set to `DEBUG` and a logger is not provided', () => {
9394
// Prepare
9495
vi.stubEnv('AWS_LAMBDA_LOG_LEVEL', 'DEBUG');
95-
96+
9697
// Act
9798
const app = new TestResolver();
98-
app.route(() => true, { path: '/', method: 'get' });
99-
99+
app.route(() => true, { path: '/', method: HttpVerbs.GET });
100+
100101
// Assess
101102
expect(console.debug).toHaveBeenCalledWith('test debug');
102103
expect(console.error).toHaveBeenCalledWith('test error');
@@ -115,8 +116,8 @@ describe('Class: BaseRouter', () => {
115116

116117
// Act
117118
const app = new TestResolver({ logger });
118-
app.route(() => true, { path: '/', method: 'get' });
119-
119+
app.route(() => true, { path: '/', method: HttpVerbs.GET });
120+
120121
// Assess
121122
expect(logger.error).toHaveBeenCalledWith('test error');
122123
expect(logger.warn).toHaveBeenCalledWith('test warn');

0 commit comments

Comments
 (0)