-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate [NpmDownloads] into one service
This moves the four npm download services into a single class, in line with #3174, and other service implementations we've written in the last couple months.
- Loading branch information
1 parent
483ecf2
commit f72daa1
Showing
3 changed files
with
117 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict' | ||
|
||
const { test, given } = require('sazerac') | ||
const NpmDownloads = require('./npm-downloads.service') | ||
|
||
describe('NpmDownloads', function() { | ||
test(NpmDownloads._intervalMap.dt.transform, () => { | ||
given({ | ||
downloads: [ | ||
{ downloads: 2, day: '2018-01-01' }, | ||
{ downloads: 3, day: '2018-01-02' }, | ||
], | ||
}).expect(5) | ||
}) | ||
|
||
test(NpmDownloads.render, () => { | ||
given({ | ||
interval: 'dt', | ||
downloadCount: 0, | ||
}).expect({ | ||
message: '0', | ||
color: 'red', | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters