Skip to content
This repository has been archived by the owner on Jan 18, 2023. It is now read-only.

Commit

Permalink
remove light
Browse files Browse the repository at this point in the history
  • Loading branch information
nahtnam committed Oct 20, 2019
1 parent 9422b8a commit 519fddd
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 96 deletions.
5 changes: 0 additions & 5 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -43,7 +43,6 @@
"decache": "^4.5.1",
"emojic": "^1.1.15",
"find-my-way": "^2.1.0",
"is-class": "0.0.8",
"lodash.set": "^4.3.2",
"micro": "^9.3.4",
"micro-boom": "^1.2.0",
Expand Down
8 changes: 4 additions & 4 deletions src/index.ts
@@ -1,14 +1,14 @@
const light = require('./light'); // eslint-disable-line
// const light = require('./light'); // eslint-disable-line
// module.exports = light.default;
// exports = light.default;
// export { default, default as light } from './light';

module.exports = light.default;
exports = light.default;

export { default as server } from './server';
export { default as params } from './params';
export { default as query } from './query';
export { default as test } from './test';
export { default as route } from './route';
export { default, default as light } from './light';
export {
buffer,
text,
Expand Down
84 changes: 0 additions & 84 deletions src/light.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/route.ts
Expand Up @@ -103,6 +103,9 @@ export default (opts?: Options): Route => {
},

handler(fn: ((req: IM, res: SR) => {} | any)): (req: IM, res: SR) => {} {
if (!fn) {
throw new Error('route is missing');
}
let func: any = fn;
if (func.default) {
func = func.default;
Expand Down
6 changes: 4 additions & 2 deletions tests/route.ts
@@ -1,6 +1,6 @@
import fetch from 'node-fetch';

import { test, light, route } from '../src/index';
import { test, route } from '../src/index';

let handler: any = (): any => ({
hello: 'world',
Expand All @@ -17,7 +17,7 @@ afterEach(async () => {
server.close();
});

describe('light', () => {
describe('route', () => {
describe('with regular function', () => {
it('returns object properly', async () => {
expect.assertions(2);
Expand Down Expand Up @@ -49,6 +49,8 @@ describe('light', () => {
describe('with null', () => {
it('throws exception', async () => {
expect.assertions(1);
const { handler: light } = route();
// @ts-ignore
expect(() => light(null)).toThrow('route is missing');
});
});
Expand Down

0 comments on commit 519fddd

Please sign in to comment.