Fixed package static tests
This commit is contained in:
parent
3ebd7c6e83
commit
6813923edb
4 changed files with 13 additions and 13 deletions
|
@ -46,34 +46,34 @@ void main() {
|
|||
});
|
||||
|
||||
test('can serve files, with correct Content-Type', () async {
|
||||
var response = await client.get('$url/sample.txt');
|
||||
var response = await client.get(Uri.parse('$url/sample.txt'));
|
||||
expect(response.body, equals('Hello world'));
|
||||
expect(response.headers['content-type'], contains('text/plain'));
|
||||
});
|
||||
|
||||
test('can serve child directories', () async {
|
||||
var response = await client.get('$url/nested');
|
||||
var response = await client.get(Uri.parse('$url/nested'));
|
||||
expect(response.body, equals('Bird'));
|
||||
expect(response.headers['content-type'], contains('text/plain'));
|
||||
});
|
||||
|
||||
test('non-existent files are skipped', () async {
|
||||
var response = await client.get('$url/nonexist.ent');
|
||||
var response = await client.get(Uri.parse('$url/nonexist.ent'));
|
||||
expect(response.body, equals('"Fallback"'));
|
||||
});
|
||||
|
||||
test('can match index files', () async {
|
||||
var response = await client.get(url);
|
||||
var response = await client.get(Uri.parse(url));
|
||||
expect(response.body, equals('index!'));
|
||||
});
|
||||
|
||||
test('virtualRoots can match index', () async {
|
||||
var response = await client.get('$url/virtual');
|
||||
var response = await client.get(Uri.parse('$url/virtual'));
|
||||
expect(response.body, equals('index!'));
|
||||
});
|
||||
|
||||
test('chrome accept', () async {
|
||||
var response = await client.get('$url/virtual', headers: {
|
||||
var response = await client.get(Uri.parse('$url/virtual'), headers: {
|
||||
'accept':
|
||||
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
|
||||
});
|
||||
|
|
|
@ -46,7 +46,7 @@ void main() {
|
|||
});
|
||||
|
||||
test('sets etag, cache-control, expires, last-modified', () async {
|
||||
var response = await client.get('$url');
|
||||
var response = await client.get(Uri.parse('$url'));
|
||||
|
||||
print('Response status: ${response.statusCode}');
|
||||
print('Response body: ${response.body}');
|
||||
|
@ -60,7 +60,7 @@ void main() {
|
|||
});
|
||||
|
||||
test('if-modified-since', () async {
|
||||
var response = await client.get('$url', headers: {
|
||||
var response = await client.get(Uri.parse('$url'), headers: {
|
||||
'if-modified-since':
|
||||
HttpDate.format(DateTime.now().add(Duration(days: 365)))
|
||||
});
|
||||
|
|
|
@ -39,23 +39,23 @@ main() async {
|
|||
tearDown(() => client.close());
|
||||
|
||||
test('prefix is not replaced in file paths', () async {
|
||||
var response = await client.get('/swagger/swagger-ui.css');
|
||||
var response = await client.get(Uri.parse('/swagger/swagger-ui.css'));
|
||||
print('Response: ${response.body}');
|
||||
expect(response, hasBody(swaggerUiCssContents));
|
||||
});
|
||||
|
||||
test('get a file without prefix in name', () async {
|
||||
var response = await client.get('/swagger/test.js');
|
||||
var response = await client.get(Uri.parse('/swagger/test.js'));
|
||||
print('Response: ${response.body}');
|
||||
expect(response, hasBody(swaggerTestJsContents));
|
||||
});
|
||||
|
||||
test('trailing slash at root', () async {
|
||||
var response = await client.get('/swagger');
|
||||
var response = await client.get(Uri.parse('/swagger'));
|
||||
var body1 = response.body;
|
||||
print('Response #1: $body1');
|
||||
|
||||
response = await client.get('/swagger/');
|
||||
response = await client.get(Uri.parse('/swagger/'));
|
||||
var body2 = response.body;
|
||||
print('Response #2: $body2');
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void main() {
|
|||
tearDown(() => client.close());
|
||||
|
||||
test('serves as fallback', () async {
|
||||
var response = await client.get('/nope');
|
||||
var response = await client.get(Uri.parse('/nope'));
|
||||
print(response);
|
||||
expect(response.body, 'index');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue