This repository was archived by the owner on Aug 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +2651
-41
lines changed
Expand file tree Collapse file tree 4 files changed +2651
-41
lines changed Original file line number Diff line number Diff line change 1+ name : Node.js yarn CI
2+
3+ on :
4+ push :
5+ branches : [ '**' ]
6+ pull_request :
7+ branches : [ '**' ]
8+
9+ jobs :
10+ build :
11+
12+ runs-on : ubuntu-latest
13+
14+ strategy :
15+ matrix :
16+ node-version : [10.x, 12.x]
17+
18+ steps :
19+ - uses : actions/checkout@v2
20+ - uses : Borales/actions-yarn@v2.1.0
21+ with :
22+ cmd : install # will run `yarn install` command
23+ - uses : Borales/actions-yarn@v2.1.0
24+ with :
25+ cmd : lint # will run `yarn build` command
26+ - uses : Borales/actions-yarn@v2.1.0
27+ with :
28+ cmd : build # will run `yarn build` command
29+ - uses : Borales/actions-yarn@v2.1.0
30+ with :
31+ cmd : test # will run `yarn test` command
Original file line number Diff line number Diff line change 1616 },
1717 "scripts" : {
1818 "build" : " bili --input src/vue-filter-number-format.js --format esm-min --format cjs-min" ,
19- "lint" : " eslint ./src"
19+ "lint" : " eslint ./src" ,
20+ "test" : " jest"
2021 },
2122 "dependencies" : {},
2223 "browserslist" : [
2930 "eslint" : " ^6.2.1" ,
3031 "eslint-config-airbnb-base" : " ^14.0.0" ,
3132 "eslint-config-foundryspatial" : " 2.1.2" ,
32- "eslint-plugin-import" : " ^2.18.2"
33+ "eslint-plugin-import" : " ^2.18.2" ,
34+ "jest" : " ^25.3.0" ,
35+ "numeral" : " ^2.0.6"
3336 },
3437 "peerDependencies" : {
3538 "numeral" : " ^2.0.0"
Original file line number Diff line number Diff line change 1+ const numeral = require ( 'numeral' ) ;
2+ const numFormat = require ( '../../dist/vue-filter-number-format.min.js' ) ( numeral ) ;
3+
4+ test ( 'Adds commas to big numbers' , ( ) => {
5+ expect ( numFormat ( 69696969 ) ) . toBe ( '69,696,969' ) ;
6+ } ) ;
7+
8+ test ( 'Returns a string, even if no commas added' , ( ) => {
9+ expect ( numFormat ( 123 ) ) . toBe ( '123' ) ;
10+ expect ( numFormat ( '456' ) ) . toBe ( '456' ) ;
11+ } ) ;
12+
13+ test ( 'Accepts custom formats' , ( ) => {
14+ expect ( numFormat ( 420 , '0.000' ) ) . toBe ( '420.000' ) ;
15+ expect ( numFormat ( 666 , '0,0o' ) ) . toBe ( '666th' ) ;
16+ } ) ;
You can’t perform that action at this time.
0 commit comments