Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.

Ensure hash works with moment #199

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions __tests__/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

///<reference path='../resources/jest.d.ts'/>

import * as moment from 'moment';
import * as jasmineCheck from 'jasmine-check';
jasmineCheck.install();

Expand Down Expand Up @@ -62,4 +63,12 @@ describe('hash', () => {
expect(hashVal).toBeGreaterThan(-Math.pow(2, 31));
expect(hashVal).toBeLessThan(Math.pow(2, 31));
});

it('should work with moment objects', () => {
const now = moment();
console.log(now);

const nowHash = hash(now);
expect(typeof nowHash).toBe('number');
});
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"marked": "1.2.3",
"microtime": "^3.0.0",
"mkdirp": "0.5.1",
"moment": "^2.29.1",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@conartist6 Any thoughts about taking on devDependencies in order to test them? I think I would prefer not to, and since this bug already has a test from your PR, we don't need to write a new one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I don't think we should if we can avoid it. Instead we should find the root cause of the incompatibility with such a dependency and simulate it ourselves. That way we make it clear to authors of any library what they can safely do. We don't want to discourage competition.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this was an issue that was fixed by #17, so I'm just going to close and the corresponding issue since it's been fixed.

"npm-run-all": "4.1.5",
"prettier": "^2.1.2",
"prop-types": "15.6.2",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6918,6 +6918,11 @@ module-deps@^6.0.0:
through2 "^2.0.0"
xtend "^4.0.0"

moment@^2.29.1:
version "2.29.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3"
integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
Expand Down