@knowark/injectarkjs
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -60,3 +60,3 @@ import { Factory } from './factory.js' // eslint-disable-line | ||
const dependencyInstances = [] | ||
for (const dependency of dependencies) { | ||
@@ -68,9 +68,8 @@ const dependencyInstance = this.resolve(dependency) | ||
} else { | ||
instance = (this.parent ? | ||
this.parent._dependencyBuild(resource, persist) : | ||
instance) | ||
const resourceStrategy = this.strategy[resource] || {} | ||
persist = (persist && resourceStrategy['unique']) | ||
instance = (this.parent | ||
? this.parent._dependencyBuild(resource, persist) | ||
: instance) | ||
const resourceStrategy = this.strategy[resource] || {} | ||
persist = (persist && resourceStrategy['unique']) | ||
} | ||
@@ -84,3 +83,2 @@ | ||
} | ||
} |
{ | ||
"name": "@knowark/injectarkjs", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Dependency Injector for Javascript", | ||
"main": "index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"clear": "rm -rf node_modules/", | ||
"test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text babel-node tests/run.js" | ||
"test": "jest --coverage" | ||
}, | ||
@@ -46,5 +46,5 @@ "repository": { | ||
"cross-env": "^5.2.0", | ||
"jasmine": "^3.3.1", | ||
"nyc": "^13.2.0" | ||
} | ||
"jest": "^24.1.0" | ||
}, | ||
"dependencies": {} | ||
} |
import { Factory } from '../lib/factory.js' | ||
describe('Factory interface', function () { | ||
let factory = null | ||
beforeEach(function () { | ||
factory = new Factory() | ||
}) | ||
describe('Factory interface', function () { | ||
beforeEach(function () { | ||
this.factory = new Factory() | ||
}) | ||
it('has an abstract extract method', function () { | ||
try { | ||
this.factory.extract('factoryMethod') | ||
} catch(error) { | ||
expect(error).toBeTruthy() | ||
} | ||
}) | ||
}) | ||
it('has an abstract extract method', function () { | ||
try { | ||
factory.extract('factoryMethod') | ||
} catch (error) { | ||
expect(error).toBeTruthy() | ||
} | ||
}) | ||
}) |
@@ -67,20 +67,21 @@ import { Injectark } from '../lib/injectark.js' | ||
describe('Injectark default', function () { | ||
let injector = null | ||
beforeEach(function () { | ||
this.injector = new Injectark() | ||
injector = new Injectark() | ||
}) | ||
it('can be instantiated', function () { | ||
expect(this.injector).toBeTruthy() | ||
expect(injector).toBeTruthy() | ||
}) | ||
it('has a null parent', function () { | ||
expect(this.injector.parent).toBeNull() | ||
expect(injector.parent).toBeNull() | ||
}) | ||
it('has an empty registry', function () { | ||
expect(this.injector.registry).toEqual({}) | ||
expect(injector.registry).toEqual({}) | ||
}) | ||
it('has an empty strategy object', function () { | ||
expect(this.injector.strategy).toEqual({}) | ||
expect(injector.strategy).toEqual({}) | ||
}) | ||
@@ -90,5 +91,5 @@ }) | ||
describe('Injectark params', function () { | ||
var parent = new Injectark() | ||
var factory = new StandardFactory() | ||
var strategy = standardStrategy | ||
let parent = new Injectark() | ||
let factory = new StandardFactory() | ||
let strategy = standardStrategy | ||
let injector = null | ||
@@ -237,4 +238,4 @@ | ||
expect(instance).toEqual(injector.parent.registry['Y']) | ||
expect( Object.keys(injector.parent.registry).length).toEqual(2) | ||
expect( Object.keys(injector.registry).length).toEqual(0) | ||
expect(Object.keys(injector.parent.registry).length).toEqual(2) | ||
expect(Object.keys(injector.registry).length).toEqual(0) | ||
}) | ||
@@ -241,0 +242,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10
10774
8
297
1