Working project
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import 'package:new_backend/shrink_ray.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
test('ShrinkRay equal urls get converted to the same shrunk url', () {
|
||||
const ytUrl = 'https://youtube.com';
|
||||
final ytRes = ShrinkRay.shrinkUrl(ytUrl);
|
||||
final ytRes2 = ShrinkRay.shrinkUrl(ytUrl);
|
||||
expect(ytRes.status, ytRes2.status);
|
||||
expect(ytRes.content, ytRes2.content);
|
||||
|
||||
const startSearchUrl = 'https://www.startpage.com/sp/search?query=how+to+be+awesome';
|
||||
final startSearchRes = ShrinkRay.shrinkUrl(startSearchUrl);
|
||||
final startSearchRes2 = ShrinkRay.shrinkUrl(startSearchUrl);
|
||||
expect(startSearchRes.status, startSearchRes2.status);
|
||||
expect(startSearchRes.content, startSearchRes2.content);
|
||||
});
|
||||
|
||||
test('ShrinkRay invalid Urls return error status and message', () {
|
||||
const badScheme = 'ht://google.com';
|
||||
final schemeRes = ShrinkRay.shrinkUrl(badScheme);
|
||||
expect(schemeRes.status, Status.error);
|
||||
|
||||
const badUrl = 'hello world';
|
||||
final urlRes = ShrinkRay.shrinkUrl(badUrl);
|
||||
expect(urlRes.status, Status.error);
|
||||
|
||||
const badPort = 'http://fosscat.com:1234';
|
||||
final portRes = ShrinkRay.shrinkUrl(badPort);
|
||||
expect(portRes.status, Status.error);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dart_frog/dart_frog.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
class _MockRequestContext extends Mock implements RequestContext {}
|
||||
|
||||
void main() {
|
||||
group('GET /', () {
|
||||
test('responds with a 200 and "Welcome to Dart Frog!".', () {
|
||||
// final context = _MockRequestContext();
|
||||
// final response = route.onRequest(context);
|
||||
// expect(response.statusCode, equals(HttpStatus.ok));
|
||||
// expect(
|
||||
// response.body(),
|
||||
// completion(equals('Welcome to Dart Frog!')),
|
||||
// );
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user