can-define-singleton
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -11,5 +11,5 @@ import QUnit from 'steal-qunit'; | ||
QUnit.ok(MyType === Decorated); | ||
QUnit.equal(Decorated.hasOwnProperty('current'), true); | ||
QUnit.equal(Decorated.hasOwnProperty('currentPromise'), true); | ||
QUnit.equal(MyType, Decorated); | ||
QUnit.ok(Decorated.hasOwnProperty('current')); | ||
QUnit.ok(Decorated.hasOwnProperty('currentPromise')); | ||
}); | ||
@@ -20,8 +20,7 @@ | ||
const factory = singleton({}); | ||
QUnit.ok(MyType !== factory); | ||
const Decorated = factory(MyType); | ||
const Decorated = factory(MyType); | ||
QUnit.ok(MyType === Decorated); | ||
QUnit.equal(Decorated.hasOwnProperty('current'), true); | ||
QUnit.equal(Decorated.hasOwnProperty('currentPromise'), true); | ||
QUnit.equal(MyType, Decorated); | ||
QUnit.ok(Decorated.hasOwnProperty('current')); | ||
QUnit.ok(Decorated.hasOwnProperty('currentPromise')); | ||
}); | ||
@@ -33,9 +32,10 @@ | ||
QUnit.equal(Decorated.hasOwnProperty('foo'), true); | ||
QUnit.equal(Decorated.hasOwnProperty('fooPromise'), true); | ||
QUnit.equal(Decorated.hasOwnProperty('current'), false); | ||
QUnit.equal(Decorated.hasOwnProperty('currentPromise'), false); | ||
QUnit.ok(Decorated.hasOwnProperty('foo')); | ||
QUnit.ok(Decorated.hasOwnProperty('fooPromise')); | ||
QUnit.notOk(Decorated.hasOwnProperty('current')); | ||
QUnit.notOk(Decorated.hasOwnProperty('currentPromise')); | ||
}); | ||
QUnit.test('Calling "current" makes call to Type.get()', function(assert){ | ||
// ensure that get() is only called once | ||
assert.expect(3); | ||
@@ -54,3 +54,3 @@ const done = assert.async(); | ||
Decorated.currentPromise.then(() => { | ||
QUnit.equal(Decorated.current, 'the value!', 'has a value'); | ||
QUnit.equal(Decorated.current, 'the value!', 'has the expected value'); | ||
done(); | ||
@@ -74,3 +74,3 @@ }); | ||
Decorated.currentPromise.then(() => { | ||
QUnit.equal(Decorated.current, 'the value!', 'has a value'); | ||
QUnit.equal(Decorated.current, 'the value!', 'has the expected value'); | ||
done(); | ||
@@ -77,0 +77,0 @@ }); |
{ | ||
"name": "can-define-singleton", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Singleton plugin for can-define", | ||
@@ -8,3 +8,3 @@ "homepage": "https://canjs.com", | ||
"type": "git", | ||
"url": "git://github.com/Bitovi/can-define-singleton.git" | ||
"url": "git://github.com/canjs/can-define-singleton.git" | ||
}, | ||
@@ -11,0 +11,0 @@ "author": { |
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
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
17914