Updated framework unit tests

This commit is contained in:
thomashii 2021-06-27 00:18:46 +08:00
parent eb52952eaa
commit 89d710fe28
2 changed files with 10 additions and 10 deletions

View file

@ -70,7 +70,7 @@ parameterMetaTests() {
test('injects header or throws', () async {
// Invalid request
var rq = MockHttpRequest('GET', Uri.parse('/header'));
rq.close();
await rq.close();
var rs = rq.response;
http.handleRequest(rq);
@ -80,7 +80,7 @@ parameterMetaTests() {
// Valid request
rq = MockHttpRequest('GET', Uri.parse('/header'))
..headers.add('x-foo', 'bar');
rq.close();
await rq.close();
rs = rq.response;
http.handleRequest(rq);
@ -93,7 +93,7 @@ parameterMetaTests() {
test('injects session or throws', () async {
// Invalid request
var rq = MockHttpRequest('GET', Uri.parse('/session'));
rq.close();
await rq.close();
var rs = rq.response;
http
.handleRequest(rq)
@ -105,7 +105,7 @@ parameterMetaTests() {
rq = MockHttpRequest('GET', Uri.parse('/session'));
rq.session['foo'] = 'bar';
rq.close();
await rq.close();
rs = rq.response;
http.handleRequest(rq);
@ -119,7 +119,7 @@ parameterMetaTests() {
test('pattern matching', () async {
var rq = MockHttpRequest('GET', Uri.parse('/match?mode=pos'));
rq.close();
await rq.close();
var rs = rq.response;
http.handleRequest(rq);
var body = await readResponse(rs);
@ -128,7 +128,7 @@ parameterMetaTests() {
expect(body, json.encode('YES pos'));
rq = MockHttpRequest('GET', Uri.parse('/match?mode=neg'));
rq.close();
await rq.close();
rs = rq.response;
http.handleRequest(rq);
body = await readResponse(rs);
@ -138,7 +138,7 @@ parameterMetaTests() {
// Fallback
rq = MockHttpRequest('GET', Uri.parse('/match?mode=ambi'));
rq.close();
await rq.close();
rs = rq.response;
http.handleRequest(rq);
body = await readResponse(rs);

View file

@ -178,7 +178,7 @@ void main() {
test('can send json', () async {
var rq = MockHttpRequest('GET', Uri(path: 'wtf'))
..headers.set('accept', 'application/json');
rq.close();
await rq.close();
http.handleRequest(rq);
await rq.response.toList();
expect(rq.response.statusCode, 403);
@ -188,7 +188,7 @@ void main() {
test('can throw in finalizer', () async {
var rq = MockHttpRequest('GET', Uri(path: 'wtf'))
..headers.set('accept', 'application/json');
rq.close();
await rq.close();
http.handleRequest(rq);
await rq.response.toList();
expect(rq.response.statusCode, 403);
@ -198,7 +198,7 @@ void main() {
test('can send html', () async {
var rq = MockHttpRequest('GET', Uri(path: 'wtf2'));
//rq.headers.set('accept', 'text/html');
rq.close();
await rq.close();
http.handleRequest(rq);
await rq.response.toList();
expect(rq.response.statusCode, 403);