Skip to content

Commit

Permalink
test: add missing http-errors types (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 authored Mar 1, 2025
1 parent 163c5df commit a1a3b68
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
with:
os: 'ubuntu-latest'
version: '16, 18.19.0, 18, 20, 22'
version: '18.19.0, 18, 20, 22'
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

[![NPM version](https://img.shields.io/npm/v/@eggjs/router.svg?style=flat-square)](https://npmjs.org/package/@eggjs/router)
[![NPM download](https://img.shields.io/npm/dm/@eggjs/router.svg?style=flat-square)](https://npmjs.org/package/@eggjs/router)
[![Node.js CI](https://github.com/eggjs/egg-router/actions/workflows/nodejs.yml/badge.svg?branch=master)](https://github.com/eggjs/egg-router/actions/workflows/nodejs.yml)
[![Test coverage](https://img.shields.io/codecov/c/github/eggjs/egg-router.svg?style=flat-square)](https://codecov.io/gh/eggjs/egg-router)
[![Node.js CI](https://github.com/eggjs/router/actions/workflows/nodejs.yml/badge.svg?branch=master)](https://github.com/eggjs/router/actions/workflows/nodejs.yml)
[![Test coverage](https://img.shields.io/codecov/c/github/eggjs/router.svg?style=flat-square)](https://codecov.io/gh/eggjs/router)
[![Known Vulnerabilities](https://snyk.io/test/npm/@eggjs/router/badge.svg?style=flat-square)](https://snyk.io/test/npm/@eggjs/router)
[![Node.js Version](https://img.shields.io/node/v/@eggjs/router.svg?style=flat)](https://nodejs.org/en/download/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/eggjs/router)

Router core component for [Egg.js](https://github.com/eggjs).

Expand Down Expand Up @@ -459,6 +462,6 @@ Run tests using `npm test`.

## Contributors

[![Contributors](https://contrib.rocks/image?repo=eggjs/egg-router)](https://github.com/eggjs/egg-router/graphs/contributors)
[![Contributors](https://contrib.rocks/image?repo=eggjs/router)](https://github.com/eggjs/router/graphs/contributors)

Made with [contributors-img](https://contrib.rocks).
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"description": "Router middleware for egg/koa. Provides RESTful resource routing.",
"repository": {
"type": "git",
"url": "https://github.com/eggjs/egg-router.git"
"url": "https://github.com/eggjs/router.git"
},
"bugs": {
"url": "https://github.com/eggjs/egg/issues"
Expand All @@ -28,19 +28,20 @@
"is-type-of": "^2.1.0",
"koa-compose": "^4.1.0",
"methods": "^1.1.2",
"path-to-regexp": "^1.1.1",
"path-to-regexp": "^1.9.0",
"urijs": "^1.19.11",
"utility": "^2.1.0"
},
"devDependencies": {
"@eggjs/koa": "^2.18.1",
"@eggjs/tsconfig": "^1.3.3",
"@types/http-errors": "^2.0.4",
"@types/koa-compose": "^3.2.8",
"@types/methods": "^1.1.4",
"@types/mocha": "^10.0.6",
"@types/supertest": "^6.0.2",
"@types/urijs": "^1.19.25",
"egg-bin": "6",
"@eggjs/bin": "7",
"eslint": "8",
"eslint-config-egg": "13",
"supertest": "^1.0.1",
Expand All @@ -55,6 +56,8 @@
"test-local": "egg-bin test",
"preci": "npm run lint && npm run prepublishOnly",
"ci": "egg-bin cov",
"postci": "npm run clean",
"clean": "tsc -b --clean",
"prepublishOnly": "tshy && tshy-after",
"bench": "cd bench && make"
},
Expand Down
7 changes: 6 additions & 1 deletion test/Router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,14 @@ describe('test/lib/router.test.js', () => {
.expect(200);
assert.equal(res.body.id, '815');
assert.equal(res.body['0'], undefined);

const res2 = await request(app.callback())
.get('/foo/1,2,3,4,5')
.expect(200);
assert.equal(res2.body.id, '1,2,3,4,5');
});

it('does not add an erroneous (.*) to unprefiexed nested routers - gh-369 gh-410', async () => {
it('does not add an erroneous (.*) to unprefixed nested routers - gh-369 gh-410', async () => {
const app = new Koa();
const router = new Router();
const nested = new Router();
Expand Down

0 comments on commit a1a3b68

Please sign in to comment.