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

leche

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leche - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

18

lib/leche.js

@@ -202,4 +202,12 @@ /**

(function(propertyKey) {
var propertyIsSet = false,
propertyValue;
Object.defineProperty(fake, key, {
get: function() {
if (propertyIsSet) {
return propertyValue;
}
throw new Error('Unexpected use of property "' + propertyKey + '".');

@@ -209,4 +217,10 @@ },

// when set, change into a data property - removes the getter and setter
Object.defineProperty(fake, key, { value: value });
propertyIsSet = true;
propertyValue = value;
// if not for https://github.com/box/leche/issues/14, we could do this
// Object.defineProperty(this, key, {
// value: value,
// writable: true
// });
},

@@ -213,0 +227,0 @@ enumerable: true,

2

package.json
{
"name": "leche",
"author": "nzakas",
"version": "2.1.0",
"version": "2.1.1",
"description": "A JavaScript testing utility designed to work with Mocha and Sinon",

@@ -6,0 +6,0 @@ "main": "./lib/leche.js",

@@ -225,7 +225,2 @@ [![Build Status](https://travis-ci.org/box/leche.png?branch=master)](https://travis-ci.org/box/leche)

* `npm run jsdoc` - creates JSDoc documentation
* `npm run deps` - updates remote dependencies
* `npm run browserify` - creates a version that will run in browsers
* `npm run patch` - create a patch version update and push to GitHub Enterprise
* `npm run minor` - create a minor version update and push to GitHub Enterprise
* `npm run major` - create a major version update and push to GitHub Enterprise

@@ -245,3 +240,3 @@ ## Developing Leche

Copyright 2014 Box, Inc. All rights reserved.
Copyright 2014-2015 Box, Inc. All rights reserved.

@@ -248,0 +243,0 @@ Licensed under the Apache License, Version 2.0 (the "License");

@@ -144,2 +144,35 @@ /**

it('should not throw an error when overwriting a property twice', function() {
var template = {
name: 'leche'
};
var fake = leche.fake(template);
fake.name = 'box';
fake.name = 'foo';
});
it('should now throw an error when there is a prototype property', function() {
// Node.js v0.10.32 issue
// see: https://github.com/box/leche/issues/14
function MyType() {
this.property = true;
}
MyType.prototype.x = true;
var template = new MyType();
var fake = leche.fake(template);
var desc = Object.getOwnPropertyDescriptor(fake, 'property');
assert.isDefined(desc.get);
fake.property = leche.fake(template.property);
// shouldn't throw error
fake.property;
});
it('should create an object with a data property when called on an object with only an accessor property', function() {

@@ -146,0 +179,0 @@

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