Added Service.findOne tests

This commit is contained in:
Tobe O 2018-07-12 11:19:25 -04:00
parent 81e768cb16
commit 60cb727ca8
10 changed files with 177 additions and 140 deletions

View file

@ -68,7 +68,7 @@
<entry key="charcode"> <entry key="charcode">
<value> <value>
<list> <list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.1/lib" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib" />
</list> </list>
</value> </value>
</entry> </entry>
@ -159,7 +159,7 @@
<entry key="http"> <entry key="http">
<value> <value>
<list> <list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http-0.11.3+16/lib" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http-0.11.3+17/lib" />
</list> </list>
</value> </value>
</entry> </entry>
@ -180,7 +180,7 @@
<entry key="http_server"> <entry key="http_server">
<value> <value>
<list> <list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_server-0.9.7/lib" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_server-0.9.8/lib" />
</list> </list>
</value> </value>
</entry> </entry>
@ -222,7 +222,7 @@
<entry key="json_god"> <entry key="json_god">
<value> <value>
<list> <list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_god-2.0.0-beta+2/lib" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_god-2.0.0-beta+3/lib" />
</list> </list>
</value> </value>
</entry> </entry>
@ -355,7 +355,7 @@
<entry key="shelf"> <entry key="shelf">
<value> <value>
<list> <list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.3+1/lib" /> <option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.3+2/lib" />
</list> </list>
</value> </value>
</entry> </entry>
@ -504,7 +504,7 @@
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/async-2.0.7/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/async-2.0.7/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/body_parser-1.1.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/body_parser-1.1.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.3/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/code_buffer-1.0.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/code_buffer-1.0.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/collection-1.14.10/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/collection-1.14.10/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/combinator-1.0.0+3/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/combinator-1.0.0+3/lib" />
@ -517,16 +517,16 @@
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.3/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/glob-1.1.6/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/glob-1.1.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http-0.11.3+16/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http-0.11.3+17/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.2/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_server-0.9.7/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_server-0.9.8/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/intl-0.15.6/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/intl-0.15.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/io-0.3.2+1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/io-0.3.2+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/jael-1.0.6+1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/jael-1.0.6+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/jael_preprocessor-1.0.0+1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/jael_preprocessor-1.0.0+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/js-0.6.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/js-0.6.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_god-2.0.0-beta+2/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_god-2.0.0-beta+3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.8/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.8/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.3/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+1/lib" />
@ -545,7 +545,7 @@
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/quiver_hashcode-1.0.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/quiver_hashcode-1.0.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/random_string-0.0.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/random_string-0.0.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.3+1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.3+2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.3/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.7+1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.7+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+2/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+2/lib" />

View file

@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="tests in find_one_test.dart" type="DartTestRunConfigurationType" factoryName="Dart Test" singleton="true" nameIsGenerated="true">
<option name="filePath" value="$PROJECT_DIR$/test/find_one_test.dart" />
<option name="testRunnerOptions" value="-j4" />
<method />
</configuration>
</component>

View file

@ -2,8 +2,12 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment=""> <list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment="">
<change afterPath="$PROJECT_DIR$/.idea/runConfigurations/tests_in_find_one_test_dart.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/test/find_one_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/service.dart" afterDir="false" /> <change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/anonymous_service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/anonymous_service.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/all.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/all.dart" afterDir="false" />
</list> </list>
<ignored path="$PROJECT_DIR$/.tmp/" /> <ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" /> <ignored path="$PROJECT_DIR$/temp/" />
@ -26,12 +30,12 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="false"> <file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/CHANGELOG.md"> <entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT"> <state split_layout="SPLIT">
<first_editor relative-caret-position="16"> <first_editor relative-caret-position="32">
<caret line="1" column="55" selection-start-line="1" selection-start-column="55" selection-end-line="1" selection-end-column="55" /> <caret line="2" column="31" selection-start-line="2" selection-start-column="31" selection-end-line="2" selection-end-column="31" />
</first_editor> </first_editor>
<second_editor /> <second_editor />
</state> </state>
@ -50,7 +54,7 @@
<file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="false"> <file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart"> <entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="4432"> <state relative-caret-position="187">
<caret line="297" column="23" selection-start-line="297" selection-start-column="23" selection-end-line="297" selection-end-column="23" /> <caret line="297" column="23" selection-start-line="297" selection-start-column="23" selection-end-line="297" selection-end-column="23" />
</state> </state>
</provider> </provider>
@ -74,11 +78,14 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="service.dart" pinned="false" current-in-tab="true"> <file leaf-file-name="find_one_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart"> <entry file="file://$PROJECT_DIR$/test/find_one_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="274"> <state relative-caret-position="128">
<caret line="78" column="40" lean-forward="true" selection-start-line="78" selection-start-column="40" selection-end-line="78" selection-end-column="40" /> <caret line="8" column="30" selection-start-line="8" selection-start-column="30" selection-end-line="8" selection-end-column="30" />
<folding>
<element signature="e#0#54#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -101,27 +108,6 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="controller_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/controller_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="784">
<caret line="56" column="29" selection-start-line="56" selection-start-column="29" selection-end-line="56" selection-end-column="29" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="routing_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/routing_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="22" column="12" selection-start-line="22" selection-start-column="12" selection-end-line="22" selection-end-column="12" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf> </leaf>
</component> </component>
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
@ -134,7 +120,6 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>HttpStatus.FORBIDDEN</find>
<find>HttpStatus.</find> <find>HttpStatus.</find>
<find>JSON</find> <find>JSON</find>
<find>ContentType.JSON.toString()</find> <find>ContentType.JSON.toString()</find>
@ -164,6 +149,7 @@
<find>redirectTo</find> <find>redirectTo</find>
<find>finalizers.t</find> <find>finalizers.t</find>
<find>`Iterable`</find> <find>`Iterable`</find>
<find>instance</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>logger?.warning</replace> <replace>logger?.warning</replace>
@ -219,7 +205,6 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/test/general_test.dart" />
<option value="$PROJECT_DIR$/lib/src/http/http.dart" /> <option value="$PROJECT_DIR$/lib/src/http/http.dart" />
<option value="$PROJECT_DIR$/performance/hello/raw.dart" /> <option value="$PROJECT_DIR$/performance/hello/raw.dart" />
<option value="$PROJECT_DIR$/lib/src/core/metadata.dart" /> <option value="$PROJECT_DIR$/lib/src/core/metadata.dart" />
@ -242,7 +227,6 @@
<option value="$PROJECT_DIR$/test/primitives_test.dart" /> <option value="$PROJECT_DIR$/test/primitives_test.dart" />
<option value="$PROJECT_DIR$/test/streaming_test.dart" /> <option value="$PROJECT_DIR$/test/streaming_test.dart" />
<option value="$PROJECT_DIR$/lib/hooks.dart" /> <option value="$PROJECT_DIR$/lib/hooks.dart" />
<option value="$PROJECT_DIR$/lib/src/core/anonymous_service.dart" />
<option value="$PROJECT_DIR$/lib/src/core/routable.dart" /> <option value="$PROJECT_DIR$/lib/src/core/routable.dart" />
<option value="$PROJECT_DIR$/test/di_test.dart" /> <option value="$PROJECT_DIR$/test/di_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" /> <option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" />
@ -263,13 +247,15 @@
<option value="$PROJECT_DIR$/test/services_test.dart" /> <option value="$PROJECT_DIR$/test/services_test.dart" />
<option value="$PROJECT_DIR$/test/hooked_test.dart" /> <option value="$PROJECT_DIR$/test/hooked_test.dart" />
<option value="$PROJECT_DIR$/test/routing_test.dart" /> <option value="$PROJECT_DIR$/test/routing_test.dart" />
<option value="$PROJECT_DIR$/test/all.dart" />
<option value="$PROJECT_DIR$/test/parameter_meta_test.dart" /> <option value="$PROJECT_DIR$/test/parameter_meta_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/response_context.dart" /> <option value="$PROJECT_DIR$/lib/src/core/response_context.dart" />
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" /> <option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/pubspec.yaml" /> <option value="$PROJECT_DIR$/pubspec.yaml" />
<option value="$PROJECT_DIR$/lib/src/core/service.dart" /> <option value="$PROJECT_DIR$/lib/src/core/service.dart" />
<option value="$PROJECT_DIR$/test/all.dart" />
<option value="$PROJECT_DIR$/test/find_one_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/anonymous_service.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
</list> </list>
</option> </option>
</component> </component>
@ -353,6 +339,7 @@
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="GO_FMT" value="false" />
<property name="HbShouldOpenHtmlAsHb" value="" /> <property name="HbShouldOpenHtmlAsHb" value="" />
<property name="SearchEverywhereHistoryKey" value="&#9;FILE&#9;file:///Users/thosakwe/Source/Dart/framework/lib/src/http/request_context.dart" /> <property name="SearchEverywhereHistoryKey" value="&#9;FILE&#9;file:///Users/thosakwe/Source/Dart/framework/lib/src/http/request_context.dart" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
@ -393,7 +380,7 @@
</list> </list>
</option> </option>
</component> </component>
<component name="RunManager" selected="Dart Test.All Tests"> <component name="RunManager" selected="Dart Test.tests in find_one_test.dart">
<configuration name="Can serialize function result as JSON in routing_test.dart" type="DartTestRunConfigurationType" factoryName="Dart Test" nameIsGenerated="true"> <configuration name="Can serialize function result as JSON in routing_test.dart" type="DartTestRunConfigurationType" factoryName="Dart Test" nameIsGenerated="true">
<option name="filePath" value="$PROJECT_DIR$/test/routing_test.dart" /> <option name="filePath" value="$PROJECT_DIR$/test/routing_test.dart" />
<option name="scope" value="GROUP_OR_TEST_BY_NAME" /> <option name="scope" value="GROUP_OR_TEST_BY_NAME" />
@ -588,6 +575,7 @@
<item itemvalue="Dart Command Line App.view.dart" /> <item itemvalue="Dart Command Line App.view.dart" />
<item itemvalue="Dart Command Line App.handle_error.dart" /> <item itemvalue="Dart Command Line App.handle_error.dart" />
<item itemvalue="Dart Command Line App.templating.dart" /> <item itemvalue="Dart Command Line App.templating.dart" />
<item itemvalue="Dart Test.tests in find_one_test.dart" />
</list> </list>
</component> </component>
<component name="SvnConfiguration"> <component name="SvnConfiguration">
@ -682,14 +670,7 @@
<workItem from="1531146644160" duration="3494000" /> <workItem from="1531146644160" duration="3494000" />
<workItem from="1531151880119" duration="141000" /> <workItem from="1531151880119" duration="141000" />
<workItem from="1531154836670" duration="378000" /> <workItem from="1531154836670" duration="378000" />
<workItem from="1531407760497" duration="353000" /> <workItem from="1531407760497" duration="832000" />
</task>
<task id="LOCAL-00055" summary="Used function syntax, deprecated `ResponseSerializer` typedef">
<created>1517975664302</created>
<option name="number" value="00055" />
<option name="presentableId" value="LOCAL-00055" />
<option name="project" value="LOCAL" />
<updated>1517975664302</updated>
</task> </task>
<task id="LOCAL-00056" summary="Deprecated all serving logic in `Angel`"> <task id="LOCAL-00056" summary="Deprecated all serving logic in `Angel`">
<created>1517976649593</created> <created>1517976649593</created>
@ -1027,19 +1008,17 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1531155020859</updated> <updated>1531155020859</updated>
</task> </task>
<option name="localTasksCounter" value="104" /> <task id="LOCAL-00104" summary="Added findOne to `Service`">
<created>1531408133584</created>
<option name="number" value="00104" />
<option name="presentableId" value="LOCAL-00104" />
<option name="project" value="LOCAL" />
<updated>1531408133586</updated>
</task>
<option name="localTasksCounter" value="105" />
<servers /> <servers />
</component> </component>
<component name="TestHistory"> <component name="TestHistory">
<history-entry file="All_Tests - 2018.06.10 at 19h 15m 55s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="All_Tests - 2018.06.20 at 15h 44m 03s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="tests_in_extension_test_dart - 2018.06.22 at 23h 46m 08s.xml">
<configuration name="tests in extension_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="tests_in_extension_test_dart - 2018.06.22 at 23h 57m 51s.xml"> <history-entry file="tests_in_extension_test_dart - 2018.06.22 at 23h 57m 51s.xml">
<configuration name="tests in extension_test.dart" configurationId="DartTestRunConfigurationType" /> <configuration name="tests in extension_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry> </history-entry>
@ -1061,9 +1040,18 @@
<history-entry file="All_Tests - 2018.07.09 at 12h 48m 12s.xml"> <history-entry file="All_Tests - 2018.07.09 at 12h 48m 12s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" /> <configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
</history-entry> </history-entry>
<history-entry file="tests_in_find_one_test_dart - 2018.07.12 at 11h 13m 12s.xml">
<configuration name="tests in find_one_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="tests_in_find_one_test_dart - 2018.07.12 at 11h 14m 14s.xml">
<configuration name="tests in find_one_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="tests_in_find_one_test_dart - 2018.07.12 at 11h 16m 10s.xml">
<configuration name="tests in find_one_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="159485000" /> <option name="totallyTimeSpent" value="159964000" />
</component> </component>
<component name="TodoView"> <component name="TodoView">
<todo-panel id="selected-file"> <todo-panel id="selected-file">
@ -1098,9 +1086,10 @@
<window_info id="Image Layers" order="2" /> <window_info id="Image Layers" order="2" />
<window_info anchor="right" id="Capture Analysis" order="3" /> <window_info anchor="right" id="Capture Analysis" order="3" />
<window_info anchor="bottom" id="Version Control" order="7" weight="0.32905984" /> <window_info anchor="bottom" id="Version Control" order="7" weight="0.32905984" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.4964476" weight="0.3973799" /> <window_info anchor="bottom" id="Run" order="2" sideWeight="0.4964476" visible="true" weight="0.3973799" />
<window_info anchor="bottom" id="Terminal" order="7" weight="0.44978166" /> <window_info anchor="bottom" id="Terminal" order="7" weight="0.44978166" />
<window_info content_ui="combo" id="Project" order="0" weight="0.26818517" /> <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.26818517" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32905984" />
<window_info anchor="right" id="SciView" order="4" /> <window_info anchor="right" id="SciView" order="4" />
<window_info anchor="right" id="Theme Preview" order="3" /> <window_info anchor="right" id="Theme Preview" order="3" />
<window_info id="Favorites" order="3" side_tool="true" /> <window_info id="Favorites" order="3" side_tool="true" />
@ -1111,7 +1100,6 @@
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" /> <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info id="DB Browser" order="2" weight="0.32998413" /> <window_info id="DB Browser" order="2" weight="0.32998413" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32905984" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="bottom" id="Messages" order="7" weight="0.33478895" /> <window_info anchor="bottom" id="Messages" order="7" weight="0.33478895" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
@ -1126,7 +1114,6 @@
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" /> <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<MESSAGE value="Fixed tests" />
<MESSAGE value="CHANGELOG" /> <MESSAGE value="CHANGELOG" />
<MESSAGE value="Update example" /> <MESSAGE value="Update example" />
<MESSAGE value="Use dart2_constant" /> <MESSAGE value="Use dart2_constant" />
@ -1151,7 +1138,8 @@
<MESSAGE value="Patch" /> <MESSAGE value="Patch" />
<MESSAGE value="Bump" /> <MESSAGE value="Bump" />
<MESSAGE value="Finalizers before sending" /> <MESSAGE value="Finalizers before sending" />
<option name="LAST_COMMIT_MESSAGE" value="Finalizers before sending" /> <MESSAGE value="Added findOne to `Service`" />
<option name="LAST_COMMIT_MESSAGE" value="Added findOne to `Service`" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>
@ -1159,13 +1147,6 @@
</breakpoint-manager> </breakpoint-manager>
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="98">
<caret line="25" column="68" selection-start-line="25" selection-start-column="68" selection-end-line="25" selection-end-column="68" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/views/index.jl"> <entry file="file://$PROJECT_DIR$/example/views/index.jl">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128"> <state relative-caret-position="128">
@ -1237,13 +1218,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/anonymous_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="64">
<caret line="5" column="28" lean-forward="true" selection-start-line="5" selection-start-column="28" selection-end-line="5" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-2.0.7/lib/src/router.dart"> <entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-2.0.7/lib/src/router.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="236"> <state relative-caret-position="236">
@ -1335,17 +1309,13 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3/lib/src/core_matchers.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="133">
<caret line="116" column="8" selection-start-line="116" selection-start-column="8" selection-end-line="116" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/typed_service_test.dart"> <entry file="file://$PROJECT_DIR$/test/typed_service_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="448"> <state relative-caret-position="448">
<caret line="28" column="17" selection-start-line="28" selection-start-column="17" selection-end-line="28" selection-end-column="17" /> <caret line="28" column="17" selection-start-line="28" selection-start-column="17" selection-end-line="28" selection-end-column="17" />
<folding>
<element signature="e#0#54#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -1360,6 +1330,9 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="436"> <state relative-caret-position="436">
<caret line="39" column="11" selection-start-line="39" selection-start-column="11" selection-end-line="39" selection-end-column="11" /> <caret line="39" column="11" selection-start-line="39" selection-start-column="11" selection-end-line="39" selection-end-column="11" />
<folding>
<element signature="e#38#92#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -1398,13 +1371,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/test/all.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="208">
<caret line="13" column="30" selection-start-line="13" selection-start-column="30" selection-end-line="13" selection-end-column="30" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/parameter_meta_test.dart"> <entry file="file://$PROJECT_DIR$/test/parameter_meta_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="336"> <state relative-caret-position="336">
@ -1461,27 +1427,27 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/http.dart"> <entry file="file://$PROJECT_DIR$/test/all.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144"> <state relative-caret-position="536">
<caret line="18" column="26" selection-start-line="18" selection-start-column="26" selection-end-line="18" selection-end-column="26" /> <caret line="37" column="28" selection-start-line="37" selection-start-column="28" selection-end-line="37" selection-end-column="28" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart"> <entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3/lib/src/core_matchers.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="4432"> <state relative-caret-position="86">
<caret line="297" column="23" selection-start-line="297" selection-start-column="23" selection-end-line="297" selection-end-column="23" /> <caret line="116" column="8" selection-start-line="116" selection-start-column="8" selection-end-line="116" selection-end-column="8" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md"> <entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="text-editor">
<state split_layout="SPLIT"> <state relative-caret-position="92">
<first_editor relative-caret-position="16"> <caret line="78" column="40" lean-forward="true" selection-start-line="78" selection-start-column="40" selection-end-line="78" selection-end-column="40" />
<caret line="1" column="55" selection-start-line="1" selection-start-column="55" selection-end-line="1" selection-end-column="55" />
</first_editor>
<second_editor />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -1492,10 +1458,44 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart"> <entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="274"> <state relative-caret-position="187">
<caret line="78" column="40" lean-forward="true" selection-start-line="78" selection-start-column="40" selection-end-line="78" selection-end-column="40" /> <caret line="297" column="23" selection-start-line="297" selection-start-column="23" selection-end-line="297" selection-end-column="23" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/http.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="144">
<caret line="18" column="26" selection-start-line="18" selection-start-column="26" selection-end-line="18" selection-end-column="26" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/anonymous_service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="182">
<caret line="29" column="57" lean-forward="true" selection-start-line="29" selection-start-column="57" selection-end-line="29" selection-end-column="57" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/find_one_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128">
<caret line="8" column="30" selection-start-line="8" selection-start-column="30" selection-end-line="8" selection-end-column="30" />
<folding>
<element signature="e#0#54#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="32">
<caret line="2" column="31" selection-start-line="2" selection-start-column="31" selection-end-line="2" selection-end-column="31" />
</first_editor>
<second_editor />
</state> </state>
</provider> </provider>
</entry> </entry>

View file

@ -1,3 +1,7 @@
# 1.1.5
* `AnonymousService` methods can now return `FutureOr`.
* Added `findOne` to `Service`.
# 1.1.4+11 # 1.1.4+11
* Close the response, etc. *after* finalizers are done. * Close the response, etc. *after* finalizers are done.

View file

@ -5,17 +5,17 @@ import 'service.dart';
/// ///
/// Well-suited for testing. /// Well-suited for testing.
class AnonymousService extends Service { class AnonymousService extends Service {
Future Function([Map]) _index; FutureOr Function([Map]) _index;
Future Function(Object, [Map]) _read, _create, _remove; FutureOr Function(Object, [Map]) _read, _create, _remove;
Future Function(Object, Object, [Map]) _modify, _update; FutureOr Function(Object, Object, [Map]) _modify, _update;
AnonymousService( AnonymousService(
{Future index([Map params]), {FutureOr index([Map params]),
Future read(id, [Map params]), FutureOr read(id, [Map params]),
Future create(data, [Map params]), FutureOr create(data, [Map params]),
Future modify(id, data, [Map params]), FutureOr modify(id, data, [Map params]),
Future update(id, data, [Map params]), FutureOr update(id, data, [Map params]),
Future remove(id, [Map params])}) FutureOr remove(id, [Map params])})
: super() { : super() {
_index = index; _index = index;
_read = read; _read = read;
@ -26,27 +26,28 @@ class AnonymousService extends Service {
} }
@override @override
index([Map params]) => _index != null ? _index(params) : super.index(params); index([Map params]) => new Future.sync(
() => _index != null ? _index(params) : super.index(params));
@override @override
read(id, [Map params]) => read(id, [Map params]) => new Future.sync(
_read != null ? _read(id, params) : super.read(id, params); () => _read != null ? _read(id, params) : super.read(id, params));
@override @override
create(data, [Map params]) => create(data, [Map params]) => new Future.sync(() =>
_create != null ? _create(data, params) : super.create(data, params); _create != null ? _create(data, params) : super.create(data, params));
@override @override
modify(id, data, [Map params]) => _modify != null modify(id, data, [Map params]) => new Future.sync(() => _modify != null
? _modify(id, data, params) ? _modify(id, data, params)
: super.modify(id, data, params); : super.modify(id, data, params));
@override @override
update(id, data, [Map params]) => _update != null update(id, data, [Map params]) => new Future.sync(() => _update != null
? _update(id, data, params) ? _update(id, data, params)
: super.update(id, data, params); : super.update(id, data, params));
@override @override
remove(id, [Map params]) => remove(id, [Map params]) => new Future.sync(
_remove != null ? _remove(id, params) : super.remove(id, params); () => _remove != null ? _remove(id, params) : super.remove(id, params));
} }

View file

@ -167,8 +167,8 @@ abstract class RequestContext {
void inject(type, value) { void inject(type, value) {
if (!app.isProduction && type is Type) { if (!app.isProduction && type is Type) {
if (!reflect(value).type.isAssignableTo(reflectType(type))) if (!reflect(value).type.isAssignableTo(reflectType(type)))
throw new ArgumentError('Cannot inject $value (${value throw new ArgumentError(
.runtimeType}) as an instance of $type.'); 'Cannot inject $value (${value.runtimeType}) as an instance of $type.');
} }
_injections[type] = value; _injections[type] = value;

View file

@ -334,8 +334,8 @@ class AngelHttp {
if (sw.isRunning) { if (sw.isRunning) {
sw?.stop(); sw?.stop();
app.logger.info("${res.statusCode} ${req.method} ${req.uri} (${sw app.logger.info(
?.elapsedMilliseconds ?? 'unknown'} ms)"); "${res.statusCode} ${req.method} ${req.uri} (${sw?.elapsedMilliseconds ?? 'unknown'} ms)");
} }
} }
}); });

View file

@ -35,7 +35,7 @@ void start(int id) {
}; };
http.startServer('127.0.0.1', 3000).then((server) { http.startServer('127.0.0.1', 3000).then((server) {
print('Instance #$id listening at http://${server.address.address}:${server print(
.port}'); 'Instance #$id listening at http://${server.address.address}:${server.port}');
}); });
} }

View file

@ -9,6 +9,7 @@ import 'di_test.dart' as di;
import 'encoders_buffer_test.dart' as encoders_buffer; import 'encoders_buffer_test.dart' as encoders_buffer;
import 'exception_test.dart' as exception; import 'exception_test.dart' as exception;
import 'extension_test.dart' as extension; import 'extension_test.dart' as extension;
import 'find_one_test.dart' as find_one;
import 'general_test.dart' as general; import 'general_test.dart' as general;
import 'hooked_test.dart' as hooked; import 'hooked_test.dart' as hooked;
import 'parameter_meta_test.dart' as parameter_meta; import 'parameter_meta_test.dart' as parameter_meta;
@ -34,6 +35,7 @@ main() {
group('encoders_buffer', encoders_buffer.main); group('encoders_buffer', encoders_buffer.main);
group('exception', exception.main); group('exception', exception.main);
group('extension', extension.main); group('extension', extension.main);
group('find_one', find_one.main);
group('general', general.main); group('general', general.main);
group('hooked', hooked.main); group('hooked', hooked.main);
group('parameter_meta', parameter_meta.main); group('parameter_meta', parameter_meta.main);

23
test/find_one_test.dart Normal file
View file

@ -0,0 +1,23 @@
import 'package:angel_framework/angel_framework.dart';
import 'package:test/test.dart';
import 'common.dart';
void main() {
var throwsAnAngelHttpException =
throwsA(const IsInstanceOf<AngelHttpException>());
test('throw 404 on null', () {
var service = new AnonymousService(index: ([p]) => null);
expect(() => service.findOne(), throwsAnAngelHttpException);
});
test('throw 404 on empty iterable', () {
var service = new AnonymousService(index: ([p]) => []);
expect(() => service.findOne(), throwsAnAngelHttpException);
});
test('return first element of iterable', () async {
var service = new AnonymousService(index: ([p]) => [2]);
expect(await service.findOne(), 2);
});
}