Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

can-define-singleton

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-define-singleton - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

28

can-define-singleton-test.js

@@ -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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc