Skip to content

Commit c46b581

Browse files
committed
Fix tests
1 parent aa4a070 commit c46b581

File tree

3 files changed

+36
-29
lines changed

3 files changed

+36
-29
lines changed

Diff for: src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import './declarations.js';
22
export { default as default } from './mw.js';
3-
export { Links, Link } from './links.js';
3+
export { Links } from './links.js';
4+
export type { Link } from './links.js';

Diff for: test/test.ts

+31-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { Application, MemoryRequest } from '@curveball/kernel';
22
import linksMw, { Links } from '../src/index.js';
3-
import { expect } from 'chai';
43
import bodyParser from '@curveball/bodyparser';
4+
import { strict as assert } from 'node:assert';
5+
import { describe, it } from 'node:test';
56

67
/**
78
*
@@ -49,10 +50,13 @@ describe('Links middleware', () => {
4950
});
5051

5152

52-
expect(result!.get('author')).to.eql({
53-
href: '/foo',
54-
rel: 'author',
55-
});
53+
assert.deepEqual(
54+
result!.get('author'),
55+
{
56+
href: '/foo',
57+
rel: 'author',
58+
}
59+
);
5660

5761
});
5862

@@ -73,9 +77,8 @@ describe('Links middleware', () => {
7377
});
7478

7579
const response = await app.subRequest('GET', '/');
76-
expect(response.status).to.eql(200);
77-
78-
expect(response.headers.get('Link')).to.eql('</foo>; rel=author');
80+
assert.equal(response.status, 200);
81+
assert.equal(response.headers.get('Link'),'</foo>; rel=author');
7982

8083
});
8184

@@ -106,19 +109,24 @@ describe('Links middleware', () => {
106109
});
107110
await app.subRequest(request);
108111

109-
expect(result!.get('author')).to.eql({
110-
href: '/foo',
111-
rel: 'author',
112-
});
113-
expect(result!.getMany('item')).to.eql([
114-
{
115-
href: '/item/1',
116-
rel: 'item',
117-
},
112+
assert.deepEqual(
113+
result!.get('author'),
118114
{
119-
href: '/item/2',
120-
rel: 'item',
121-
},
115+
href: '/foo',
116+
rel: 'author',
117+
}
118+
);
119+
assert.deepEqual(
120+
result!.getMany('item'),
121+
[
122+
{
123+
href: '/item/1',
124+
rel: 'item',
125+
},
126+
{
127+
href: '/item/2',
128+
rel: 'item',
129+
},
122130
]);
123131

124132
});
@@ -142,8 +150,9 @@ describe('Links middleware', () => {
142150
}, 'hi');
143151
await app.subRequest(request);
144152

145-
expect(result!.get('author')).to.eql(undefined);
146-
expect(result!.getMany('item')).to.eql([]);
153+
154+
assert.equal(result!.get('author'), undefined);
155+
assert.deepEqual(result!.getMany('item'),[]);
147156

148157
});
149158
});

Diff for: tsconfig.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@
1010
"sourceMap": true,
1111
"outDir": "dist",
1212
"baseUrl": ".",
13-
"paths": {
14-
"*": [
15-
"src/types/*"
16-
]
17-
},
13+
"rootDir": "..",
14+
1815
"lib": [
1916
"DOM",
2017
"ES2022"
2118
],
2219
"declaration": true
2320
},
2421
"include": [
25-
"src/**/*"
22+
"**/*.ts"
2623
]
2724
}

0 commit comments

Comments
 (0)