Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
01e22883
Commit
01e22883
authored
Feb 06, 2020
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update JSDoc and test descriptions in response to PR feedback
parent
cc2b85cc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
injector.js
src/shared/injector.js
+1
-0
injector-test.js
src/shared/test/injector-test.js
+2
-2
No files found.
src/shared/injector.js
View file @
01e22883
...
@@ -99,6 +99,7 @@ export class Injector {
...
@@ -99,6 +99,7 @@ export class Injector {
* @param {() => any} factory -
* @param {() => any} factory -
* A function that constructs the service, or a class that will be instantiated
* A function that constructs the service, or a class that will be instantiated
* when the object is requested.
* when the object is requested.
* @return {this}
*/
*/
register
(
name
,
factory
)
{
register
(
name
,
factory
)
{
this
.
_factories
.
set
(
name
,
factory
);
this
.
_factories
.
set
(
name
,
factory
);
...
...
src/shared/test/injector-test.js
View file @
01e22883
...
@@ -2,7 +2,7 @@ import { Injector } from '../injector';
...
@@ -2,7 +2,7 @@ import { Injector } from '../injector';
describe
(
'Injector'
,
()
=>
{
describe
(
'Injector'
,
()
=>
{
describe
(
'#get'
,
()
=>
{
describe
(
'#get'
,
()
=>
{
it
(
'calls
factory
function to create instance'
,
()
=>
{
it
(
'calls
a non-class factory as a
function to create instance'
,
()
=>
{
const
instance
=
{};
const
instance
=
{};
const
factory
=
sinon
.
stub
().
returns
(
instance
);
const
factory
=
sinon
.
stub
().
returns
(
instance
);
...
@@ -13,7 +13,7 @@ describe('Injector', () => {
...
@@ -13,7 +13,7 @@ describe('Injector', () => {
assert
.
equal
(
constructed
,
instance
);
assert
.
equal
(
constructed
,
instance
);
});
});
it
(
'calls
constructor
to create instance'
,
()
=>
{
it
(
'calls
a class factory with `new`
to create instance'
,
()
=>
{
class
Foo
{}
class
Foo
{}
const
container
=
new
Injector
();
const
container
=
new
Injector
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment