From 9c2f1dd0cbe4b807a0d1738a1cd3bee984ec9cb3 Mon Sep 17 00:00:00 2001 From: "thomashii@dukefirehawk.com" Date: Sat, 29 May 2021 09:14:16 +0800 Subject: [PATCH] Fixed framework test cases --- CHANGELOG.md | 4 ++-- packages/framework/CHANGELOG.md | 5 +++++ packages/framework/README.md | 2 +- packages/framework/lib/src/core/service.dart | 6 +++--- packages/framework/pubspec.yaml | 2 +- packages/framework/test/parse_id_test.dart | 7 ++----- packages/framework/test/services_test.dart | 1 - 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f82535f8..4d704b69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ * Migrated angel_container to 3.0.0 (55/55 tests passed) * Added merge_map and migrated to 2.0.0 (6/6 tests passed) * Added mock_request and migrated to 2.0.0 (0/0 tests) -* Migrated angel_framework to 4.0.0 (148/150 tests passed) +* Migrated angel_framework to 4.0.0 (149/150 tests passed) * Migrated angel_auth to 4.0.0 (23/30 tests passed) * Migrated angel_configuration to 4.0.0 (6/8 testspassed) * Migrated angel_validate to 4.0.0 (6/7 tests passed) @@ -49,7 +49,7 @@ * Updated angel_route to 4.0.0 (35/35 tests passed) * Updated angel_model to 2.0.0 (0/0 tests passed) * Updated angel_container to 2.0.0 (55/55 tests passed) -* Updated angel_framework to 3.0.0 (151/151 tests passed) +* Updated angel_framework to 3.0.0 (150/151 tests passed) * Updated angel_auth to 3.0.0 (28/32 tests passed) * Updated angel_configuration to 3.0.0 (6/8 tests passed) * Updated angel_validate to 3.0.0 (7/7 tests passed) diff --git a/packages/framework/CHANGELOG.md b/packages/framework/CHANGELOG.md index d25d881d..da125c8b 100644 --- a/packages/framework/CHANGELOG.md +++ b/packages/framework/CHANGELOG.md @@ -1,3 +1,8 @@ +# 4.0.3 +* Fixed "Primitive after parsed param injection" test case +* Fixed "Cannot remove all unless explicitly set" test case +* Fixed "null" test case + # 4.0.2 * Updated README diff --git a/packages/framework/README.md b/packages/framework/README.md index 8cd577b0..17b78a3e 100644 --- a/packages/framework/README.md +++ b/packages/framework/README.md @@ -1,5 +1,5 @@ # angel3_framework -[![version](https://img.shields.io/badge/pub-v4.0.2-brightgreen)](https://pub.dartlang.org/packages/angel3_framework) +[![version](https://img.shields.io/badge/pub-v4.0.3-brightgreen)](https://pub.dartlang.org/packages/angel3_framework) [![Null Safety](https://img.shields.io/badge/null-safety-brightgreen)](https://dart.dev/null-safety) [![Gitter](https://img.shields.io/gitter/room/angel_dart/discussion)](https://gitter.im/angel_dart/discussion) diff --git a/packages/framework/lib/src/core/service.dart b/packages/framework/lib/src/core/service.dart index 30b05c4b..f61edd87 100644 --- a/packages/framework/lib/src/core/service.dart +++ b/packages/framework/lib/src/core/service.dart @@ -195,9 +195,9 @@ class Service extends Routable { /// /// For example, `parseId` attempts to parse the value as a [bool]. static T parseId(id) { - if (id == 'null' || id == null) { - //return 'null' as T; - throw ArgumentError("[Service] Null is not supported"); + if (id == null || id == 'null') { + return 'null' as T; + //throw ArgumentError("[Service] Null is not supported"); } else if (T == String) { return id.toString() as T; } else if (T == int) { diff --git a/packages/framework/pubspec.yaml b/packages/framework/pubspec.yaml index d20baf67..c0fbcdd7 100644 --- a/packages/framework/pubspec.yaml +++ b/packages/framework/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_framework -version: 4.0.2 +version: 4.0.3 description: A high-powered HTTP server with dependency injection, routing and much more. homepage: https://github.com/dukefirehawk/angel/tree/angel3/packages/framework publish_to: none diff --git a/packages/framework/test/parse_id_test.dart b/packages/framework/test/parse_id_test.dart index f44a01e1..d99cc907 100644 --- a/packages/framework/test/parse_id_test.dart +++ b/packages/framework/test/parse_id_test.dart @@ -3,11 +3,8 @@ import 'package:test/test.dart'; void main() { test('null', () { - //expect(Service.parseId('null'), null); - //expect(Service.parseId(null), null); - - expect(() => Service.parseId('null'), throwsArgumentError); - expect(() => Service.parseId(null), throwsArgumentError); + expect(Service.parseId('null'), 'null'); + expect(Service.parseId(null), 'null'); }); test('String', () { diff --git a/packages/framework/test/services_test.dart b/packages/framework/test/services_test.dart index 7f154abb..02797674 100644 --- a/packages/framework/test/services_test.dart +++ b/packages/framework/test/services_test.dart @@ -126,7 +126,6 @@ void main() { }); test('cannot remove all unless explicitly set', () async { - var a = "1234"; var response = await client.delete(Uri.parse('$url/todos/null')); expect(response.statusCode, 403); });