Commit 01e22883 authored by Robert Knight's avatar Robert Knight

Update JSDoc and test descriptions in response to PR feedback

parent cc2b85cc
...@@ -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);
......
...@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment