Commit fc68ec39 authored by sunguoshu's avatar sunguoshu

增加prettier

parent 61a0d399
Pipeline #315 canceled with stages
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
\ No newline at end of file
......@@ -10,6 +10,7 @@
"author": "",
"license": "ISC",
"devDependencies": {
"prettier": "^3.0.0",
"typescript": "^5.1.6",
"vitest": "^0.33.0"
}
......
lockfileVersion: 5.4
specifiers:
prettier: ^3.0.0
typescript: ^5.1.6
vitest: ^0.33.0
devDependencies:
prettier: 3.0.0
typescript: 5.1.6
vitest: 0.33.0
......@@ -460,6 +462,12 @@ packages:
source-map-js: 1.0.2
dev: true
/prettier/3.0.0:
resolution: {integrity: sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==}
engines: {node: '>=14'}
hasBin: true
dev: true
/pretty-format/29.6.1:
resolution: {integrity: sha512-7jRj+yXO0W7e4/tSJKoR7HRIHLPPjtNaUGG2xxKQnGvPNRkgWcQ0AZX6P4KBRJN4FcTBWb3sa7DVUJmocYuoog==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
......
......@@ -78,36 +78,35 @@ describe('测试整数', () => {
expect(numberToWords(1111)).toBe('壹仟壹佰壹拾壹元整')
})
it('100010000.00 toBe 壹亿零壹万元', () => {
expect(numberToWords(100010000.00)).toBe('壹亿零壹万元整')
expect(numberToWords(100010000.0)).toBe('壹亿零壹万元整')
})
it('1001000000 toBe 壹拾亿零壹佰万元整',()=>{
it('1001000000 toBe 壹拾亿零壹佰万元整', () => {
expect(numberToWords(1001000000)).toBe('壹拾亿零壹佰万元整')
})
it('500000008 toBe 伍亿零捌元整',()=>{
it('500000008 toBe 伍亿零捌元整', () => {
expect(numberToWords(500000008)).toBe('伍亿零捌元整')
})
it('500000080 toBe 伍亿零捌拾元整',()=>{
it('500000080 toBe 伍亿零捌拾元整', () => {
expect(numberToWords(500000080)).toBe('伍亿零捌拾元整')
})
it('500000080 toBe 伍亿零捌佰元整',()=>{
it('500000080 toBe 伍亿零捌佰元整', () => {
expect(numberToWords(500000800)).toBe('伍亿零捌佰元整')
})
it('500008000 toBe 伍亿零捌仟元整',()=>{
it('500008000 toBe 伍亿零捌仟元整', () => {
expect(numberToWords(500008000)).toBe('伍亿零捌仟元整')
})
it('500080000 toBe 伍亿零捌万元整',()=>{
it('500080000 toBe 伍亿零捌万元整', () => {
expect(numberToWords(500080000)).toBe('伍亿零捌万元整')
})
it('500800000 toBe 伍亿零捌拾万元整',()=>{
it('500800000 toBe 伍亿零捌拾万元整', () => {
expect(numberToWords(500800000)).toBe('伍亿零捌拾万元整')
})
it('508000000 toBe 伍亿零捌佰万元整',()=>{
it('508000000 toBe 伍亿零捌佰万元整', () => {
expect(numberToWords(508000000)).toBe('伍亿零捌佰万元整')
})
it('580000000 toBe 伍亿捌仟万元整',()=>{
it('580000000 toBe 伍亿捌仟万元整', () => {
expect(numberToWords(580000000)).toBe('伍亿捌仟万元整')
})
})
describe('测试小数', () => {
......@@ -139,33 +138,32 @@ describe('测试小数', () => {
expect(numberToWords(0.09)).toBe('玖分')
})
it('0.10 toBe 壹角', () => {
expect(numberToWords(0.10)).toBe('壹角')
expect(numberToWords(0.1)).toBe('壹角')
})
it('0.11 toBe 壹角壹分', () => {
expect(numberToWords(0.11)).toBe('壹角壹分')
})
it('0.20 toBe 贰角', () => {
expect(numberToWords(0.20)).toBe('贰角')
expect(numberToWords(0.2)).toBe('贰角')
})
it('0.55 toBe 伍角伍分', () => {
expect(numberToWords(0.55)).toBe('伍角伍分')
})
it('1.00 toBe 壹元整', () => {
expect(numberToWords(1.00)).toBe('壹元整')
expect(numberToWords(1.0)).toBe('壹元整')
})
it('1.01 toBe 壹元零壹分', () => {
expect(numberToWords(1.01)).toBe('壹元零壹分')
})
it('1.10 toBe 壹元壹角', () => {
expect(numberToWords(1.10)).toBe('壹元壹角')
expect(numberToWords(1.1)).toBe('壹元壹角')
})
it('1.11 toBe 壹元壹角壹分', () => {
expect(numberToWords(1.11)).toBe('壹元壹角壹分')
})
it('10.00 toBe 壹拾元整', () => {
expect(numberToWords(10.00)).toBe('壹拾元整')
expect(numberToWords(10.0)).toBe('壹拾元整')
})
})
describe('测试极端小数', () => {
......@@ -175,10 +173,11 @@ describe('测试极端小数', () => {
it('1.009 toBe 壹元整', () => {
expect(numberToWords(1.009)).toBe('壹元整')
})
it('1.011 toBe 壹元零壹分', () => {
expect(numberToWords(1.011)).toBe('壹元零壹分')
})
it('0.455', function () {
it('0.455', () => {
expect(numberToWords(0.455)).toBe('肆角伍分')
})
it('0.456', function () {
......@@ -186,11 +185,11 @@ describe('测试极端小数', () => {
})
})
describe('小数整数',()=>{
describe('小数整数', () => {
it('17916.67 toBe 壹万柒仟玖佰壹拾陆元陆角柒分', () => {
expect(numberToWords(17916.67)).toBe('壹万柒仟玖佰壹拾陆元陆角柒分')
})
it('100010000.01 toBe 壹亿零壹万元零壹分', () => {
expect(numberToWords(100010000.01)).toBe('壹亿零壹万元零壹分')
})
})
\ No newline at end of file
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment