Skip to content

Commit

Permalink
fix: Moving tests to make room for E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrydn committed Mar 18, 2024
1 parent bdb1580 commit 3a27a62
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/config.test.mjs → test/unit/config.test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'assert';
import { getConfig } from '../lib/config.mjs';
import { getConfig } from '../../lib/config.mjs';

describe('lib/config', () => {
it('should return default config', () => {
Expand Down
7 changes: 6 additions & 1 deletion test/handlers.test.mjs → test/unit/handlers.test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'assert';
import { getHandler, runHandler } from '../lib/handlers.mjs';
import { getHandler, runHandler } from '../../lib/handlers.mjs';

describe('lib/handlers', () => {
describe('#getHandler', () => {
Expand All @@ -17,6 +17,11 @@ describe('lib/handlers', () => {
const handler = await getHandler('test/handlers/plain-modulejs.handler');
assert.ok(typeof handler === 'function', 'Expected handler to be a function');
});

it('should return a valid handler (.ts)', async () => {
const handler = await getHandler('test/handlers/typed.handler');
assert.ok(typeof handler === 'function', 'Expected handler to be a function');
});
});

describe('#runHandler', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/requests.test.mjs → test/unit/requests.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import assert from 'assert';
import axios from 'axios';
import { randomBytes } from 'crypto';
import { createServer } from 'http';
import { getReqHeader, getReqBody, setResResult } from '../lib/requests.mjs';
import { getReqHeader, getReqBody, setResResult } from '../../lib/requests.mjs';

describe('lib/requests', () => {
function httpRequest(config, assertion) {
Expand Down
2 changes: 1 addition & 1 deletion test/server.test.mjs → test/unit/server.test.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert';
import axios from 'axios';
import { createServer } from '../lib/server.mjs';
import { createServer } from '../../lib/server.mjs';

describe('lib/server', () => {
async function httpRequest({ createEvent, createContext, handlerName = 'app.handler', handlerFn }) {
Expand Down
2 changes: 1 addition & 1 deletion test/utils.test.mjs → test/unit/utils.test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'assert';
import { getApiGatewayReqTime, getContextLogStreamTime, isPlainObject } from '../lib/utils.mjs';
import { getApiGatewayReqTime, getContextLogStreamTime, isPlainObject } from '../../lib/utils.mjs';

describe('lib/utils', () => {

Expand Down

0 comments on commit 3a27a62

Please sign in to comment.