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

frozen

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frozen

Provides functionality for freezing time and dates

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-35.71%
Maintainers
1
Weekly downloads
 
Created
Source

Frozen

Provides methods for stubbing time.

npm install frozen

Example

var freeze = require('frozen').freeze
  , melt = require('frozen').melt;

describe('Time', function() {
  afterEach(melt);

  it('is frozen', function() {
    freeze(new Date(2011, 1, 13, 8, 33, 14, 274));

    var date1 = new Date();
    sleep(30);
    var date2 = new Date();

    expect(date1.getFullYear()).to.equal(2011);
    expect(date1.getMonth()).to.equal(1);
    expect(date1.getDate()).to.equal(13);
    expect(date1.getHours()).to.equal(8);
    expect(date1.getMinutes()).to.equal(33);
    expect(date1.getSeconds()).to.equal(14);
    expect(date1.getMilliseconds()).to.equal(274);

    expect(date2.getFullYear()).to.equal(2011);
    expect(date2.getMonth()).to.equal(1);
    expect(date2.getDate()).to.equal(13);
    expect(date2.getHours()).to.equal(8);
    expect(date2.getMinutes()).to.equal(33);
    expect(date2.getSeconds()).to.equal(14);
    expect(date2.getMilliseconds()).to.equal(274);
  });
});

API

.freeze([date]) → undefined

Freezes the current time to that of the date argument (which must be a Date), or the current datetime if no arguments are provided.

.melt() → undefined

Returns Date to the normal, native Date.

License

MIT

Keywords

FAQs

Package last updated on 03 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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