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

react-moment-proptypes

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-moment-proptypes - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

12

index.js

@@ -22,7 +22,9 @@ var moment = require('moment');

propFullName = propFullName || propName;
return new Error(
'Required ' + locationName + ' `' + propFullName +
'` was not specified in `' +
componentName + '`.'
);
if (!props.hasOwnProperty(propName)) {
return new Error(
'Required ' + locationName + ' `' + propFullName +
'` was not specified in `' +
componentName + '`.'
);
}
}

@@ -29,0 +31,0 @@

{
"name": "react-moment-proptypes",
"version": "1.1.1",
"version": "1.1.2",
"description": "React proptype for moment module",

@@ -5,0 +5,0 @@ "keywords": [

@@ -30,1 +30,8 @@ # react-moment-proptypes

```
# Tests
Tests were approached with `jsdom` and React's test utility renderer
- `npm test` for running unit tests
- `npm run coverage` for current test coverage

@@ -10,2 +10,6 @@ import React from 'react';

function constructWarningsMessage(warnings) {
return 'warnings: ' + JSON.stringify(warnings);
}
describe('ProptypeTests', () => {

@@ -269,2 +273,31 @@

describe('Correct Required Input', () => {
before(() => {
TestClass = React.createClass({
propTypes : {
testValidString : MomentPropTypes.momentString.isRequired,
testValidObject : MomentPropTypes.momentObj.isRequired,
},
render() {
return null;
},
});
});
it('should have no warnings for the optional moment string', (done) => {
const testElement = <TestClass testValidString={'12-12-2015'} testValidObject={moment()} />;
TestUtils.renderIntoDocument(testElement);
expect(warnings).to.be.an('array', constructWarningsMessage(warnings));
expect(warnings.length).to.equal(0, constructWarningsMessage(warnings));
done();
});
});
});
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