1
0
mirror of https://github.com/badges/shields.git synced 2025-09-18 05:05:28 +03:00
Files
shields/services/npm-stat/npm-stat-downloads.spec.js
Huan 57ba623fd6 Add [NpmStatDownloads] Badge (#9783)
* feat: add npm downloads (by author) badge

* Update services/npm-stat/npm-stat-downloads.service.js

Co-authored-by: chris48s <chris48s@users.noreply.github.com>

* test: add test cases for NpmStatDownloads helper getTotalDownloads

* refactor: using dayjs to get from && until date string

* feat: remove support of dt

---------

Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2023-12-12 19:19:22 +00:00

26 lines
621 B
JavaScript

import { test, given } from 'sazerac'
import NpmStatDownloads from './npm-stat-downloads.service.js'
describe('NpmStatDownloads helpers', function () {
test(NpmStatDownloads.getTotalDownloads, () => {
given({
'hexo-theme-candelas': {
'2022-12-01': 1,
'2022-12-02': 2,
'2022-12-03': 3,
},
'@dukeluo/fanjs': {
'2022-12-01': 10,
'2022-12-02': 20,
'2022-12-03': 30,
},
'eslint-plugin-check-file': {
'2022-12-01': 100,
'2022-12-02': 200,
'2022-12-03': 300,
},
}).expect(666)
given({}).expect(0)
})
})