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

chronokinesis

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chronokinesis - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

1

index.js

@@ -81,3 +81,2 @@ /**

FakeDate.prototype = NativeDate.prototype;
FakeDate.prototype.constructor = NativeDate.constructor;

@@ -84,0 +83,0 @@ FakeDate.now = function() {

3

package.json
{
"name": "chronokinesis",
"version": "1.0.1",
"version": "1.0.2",
"description": "Module for testing time-dependent code",

@@ -35,4 +35,5 @@ "author": "Pal Edman <pal.edman@outlook.com>",

"lab": "^10.3.0",
"lodash": "^4.11.1",
"moment": "^2.12.0"
}
}
'use strict';
const _ = require('lodash');
const NativeDate = Date;
const expect = require('code').expect;

@@ -245,2 +247,27 @@ const Lab = require('lab');

lab.test('resets Date to native Date', (done) => {
expect(Date).to.equal(NativeDate);
ck.freeze();
expect(Date).to.not.equal(NativeDate);
ck.reset();
expect(Date).to.equal(NativeDate);
expect(Date.constructor).to.equal(NativeDate.constructor);
expect(Date.constructor.prototype).to.equal(NativeDate.constructor.prototype);
expect(new Date()).to.be.instanceOf(NativeDate).and.not.a.function();
done();
});
lab.test('after reset in combination with lodash cloneDeep returns native Date', (done) => {
let content = _.assign(_.cloneDeep({
d: new Date()
}));
expect(content.d).to.not.be.a.function().and.instanceOf(NativeDate);
done();
});
lab.test('resets frozen time', (done) => {

@@ -247,0 +274,0 @@ let dateObj = new Date();

Sorry, the diff of this file is not supported yet

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