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">
<value>
<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>
</value>
</entry>
@ -159,7 +159,7 @@
<entry key="http">
<value>
<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>
</value>
</entry>
@ -180,7 +180,7 @@
<entry key="http_server">
<value>
<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>
</value>
</entry>
@ -222,7 +222,7 @@
<entry key="json_god">
<value>
<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>
</value>
</entry>
@ -355,7 +355,7 @@
<entry key="shelf">
<value>
<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>
</value>
</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/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/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/collection-1.14.10/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/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/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_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/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_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/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/kernel-0.3.3/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/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/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_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" />

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">
<component name="ChangeListManager">
<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$/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>
<ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" />
@ -26,12 +30,12 @@
</component>
<component name="FileEditorManager">
<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">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="16">
<caret line="1" column="55" selection-start-line="1" selection-start-column="55" selection-end-line="1" selection-end-column="55" />
<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>
@ -50,7 +54,7 @@
<file leaf-file-name="angel_http.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/http/angel_http.dart">
<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" />
</state>
</provider>
@ -74,11 +78,14 @@
</provider>
</entry>
</file>
<file leaf-file-name="service.dart" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
<file leaf-file-name="find_one_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/find_one_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="274">
<caret line="78" column="40" lean-forward="true" selection-start-line="78" selection-start-column="40" selection-end-line="78" selection-end-column="40" />
<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>
@ -101,27 +108,6 @@
</provider>
</entry>
</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>
</component>
<component name="FileTemplateManagerImpl">
@ -134,7 +120,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>HttpStatus.FORBIDDEN</find>
<find>HttpStatus.</find>
<find>JSON</find>
<find>ContentType.JSON.toString()</find>
@ -164,6 +149,7 @@
<find>redirectTo</find>
<find>finalizers.t</find>
<find>`Iterable`</find>
<find>instance</find>
</findStrings>
<replaceStrings>
<replace>logger?.warning</replace>
@ -219,7 +205,6 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/test/general_test.dart" />
<option value="$PROJECT_DIR$/lib/src/http/http.dart" />
<option value="$PROJECT_DIR$/performance/hello/raw.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/streaming_test.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$/test/di_test.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/hooked_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$/lib/src/core/response_context.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$/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>
</option>
</component>
@ -353,6 +339,7 @@
</panes>
</component>
<component name="PropertiesComponent">
<property name="GO_FMT" value="false" />
<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="WebServerToolWindowFactoryState" value="false" />
@ -393,7 +380,7 @@
</list>
</option>
</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">
<option name="filePath" value="$PROJECT_DIR$/test/routing_test.dart" />
<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.handle_error.dart" />
<item itemvalue="Dart Command Line App.templating.dart" />
<item itemvalue="Dart Test.tests in find_one_test.dart" />
</list>
</component>
<component name="SvnConfiguration">
@ -682,14 +670,7 @@
<workItem from="1531146644160" duration="3494000" />
<workItem from="1531151880119" duration="141000" />
<workItem from="1531154836670" duration="378000" />
<workItem from="1531407760497" duration="353000" />
</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>
<workItem from="1531407760497" duration="832000" />
</task>
<task id="LOCAL-00056" summary="Deprecated all serving logic in `Angel`">
<created>1517976649593</created>
@ -1027,19 +1008,17 @@
<option name="project" value="LOCAL" />
<updated>1531155020859</updated>
</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 />
</component>
<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">
<configuration name="tests in extension_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
@ -1061,9 +1040,18 @@
<history-entry file="All_Tests - 2018.07.09 at 12h 48m 12s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
</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 name="TimeTrackingManager">
<option name="totallyTimeSpent" value="159485000" />
<option name="totallyTimeSpent" value="159964000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@ -1098,9 +1086,10 @@
<window_info id="Image Layers" order="2" />
<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="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 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="Theme Preview" order="3" />
<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="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<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="bottom" id="Messages" order="7" weight="0.33478895" />
<window_info anchor="bottom" id="Message" order="0" />
@ -1126,7 +1114,6 @@
</component>
<component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<MESSAGE value="Fixed tests" />
<MESSAGE value="CHANGELOG" />
<MESSAGE value="Update example" />
<MESSAGE value="Use dart2_constant" />
@ -1151,7 +1138,8 @@
<MESSAGE value="Patch" />
<MESSAGE value="Bump" />
<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 name="XDebuggerManager">
<breakpoint-manager>
@ -1159,13 +1147,6 @@
</breakpoint-manager>
</component>
<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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128">
@ -1237,13 +1218,6 @@
</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="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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="236">
@ -1335,17 +1309,13 @@
</state>
</provider>
</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">
<provider selected="true" editor-type-id="text-editor">
<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" />
<folding>
<element signature="e#0#54#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -1360,6 +1330,9 @@
<provider selected="true" editor-type-id="text-editor">
<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" />
<folding>
<element signature="e#38#92#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -1398,13 +1371,6 @@
</state>
</provider>
</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">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="336">
@ -1461,27 +1427,27 @@
</state>
</provider>
</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">
<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 relative-caret-position="536">
<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>
</provider>
</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">
<state relative-caret-position="4432">
<caret line="297" column="23" selection-start-line="297" selection-start-column="23" selection-end-line="297" selection-end-column="23" />
<state relative-caret-position="86">
<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$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="16">
<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 />
<entry file="file://$PROJECT_DIR$/lib/src/core/service.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="92">
<caret line="78" column="40" lean-forward="true" selection-start-line="78" selection-start-column="40" selection-end-line="78" selection-end-column="40" />
</state>
</provider>
</entry>
@ -1492,10 +1458,44 @@
</state>
</provider>
</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">
<state relative-caret-position="274">
<caret line="78" column="40" lean-forward="true" selection-start-line="78" selection-start-column="40" selection-end-line="78" selection-end-column="40" />
<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" />
</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>
</provider>
</entry>

View file

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

View file

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

View file

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

View file

@ -334,8 +334,8 @@ class AngelHttp {
if (sw.isRunning) {
sw?.stop();
app.logger.info("${res.statusCode} ${req.method} ${req.uri} (${sw
?.elapsedMilliseconds ?? 'unknown'} ms)");
app.logger.info(
"${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) {
print('Instance #$id listening at http://${server.address.address}:${server
.port}');
print(
'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 'exception_test.dart' as exception;
import 'extension_test.dart' as extension;
import 'find_one_test.dart' as find_one;
import 'general_test.dart' as general;
import 'hooked_test.dart' as hooked;
import 'parameter_meta_test.dart' as parameter_meta;
@ -34,6 +35,7 @@ main() {
group('encoders_buffer', encoders_buffer.main);
group('exception', exception.main);
group('extension', extension.main);
group('find_one', find_one.main);
group('general', general.main);
group('hooked', hooked.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);
});
}