Updated mock_request test cases

This commit is contained in:
thomashii 2021-06-23 21:06:57 +08:00
parent 92b3f0b74f
commit 32db2c2b46
2 changed files with 9 additions and 12 deletions

View file

@ -7,6 +7,7 @@ environment:
dependencies: dependencies:
charcode: ^1.2.0 charcode: ^1.2.0
dev_dependencies: dev_dependencies:
#angel_framework: ^2.1.0 angel3_framework: ^4.0.0
http: ^0.13.2 http: ^0.13.2
test: ^1.17.4 test: ^1.17.4
pedantic: ^1.11.0

View file

@ -1,27 +1,24 @@
//import 'dart:convert'; import 'dart:convert';
//import 'dart:io'; import 'dart:io';
//import 'package:angel_framework/angel_framework.dart'; import 'package:angel3_framework/angel3_framework.dart';
//import 'package:angel_framework/http.dart'; import 'package:angel3_framework/http.dart';
//import 'package:mock_request/mock_request.dart'; import 'package:angel3_mock_request/angel3_mock_request.dart';
//import 'package:test/test.dart'; import 'package:test/test.dart';
void main() { void main() {
/*
var uri = Uri.parse('http://localhost:3000'); var uri = Uri.parse('http://localhost:3000');
var app = Angel() var app = Angel()
..get('/foo', (req, res) => 'Hello, world!') ..get('/foo', (req, res) => 'Hello, world!')
..post('/body', ..post('/body',
(req, res) => req.parseBody().then((_) => req.bodyAsMap.length)) (req, res) => req.parseBody().then((_) => req.bodyAsMap.length))
..get('/session', (req, res) async { ..get('/session', (req, res) async {
req.session['foo'] = 'bar'; req.session?['foo'] = 'bar';
}) })
..get('/conn', (RequestContext req, res) { ..get('/conn', (RequestContext req, res) {
return res.serialize(req.ip == InternetAddress.loopbackIPv4.address); return res.serialize(req.ip == InternetAddress.loopbackIPv4.address);
}); });
var http = AngelHttp(app); var http = AngelHttp(app);
test('receive a response', () async { test('receive a response', () async {
@ -67,5 +64,4 @@ void main() {
expect(rq.uri.path, '/mock'); expect(rq.uri.path, '/mock');
expect(rq.requestedUri.toString(), 'http://example.com/mock'); expect(rq.requestedUri.toString(), 'http://example.com/mock');
}); });
*/
} }