|
- import getKiloCount from './getKiloCount'
-
- it('should exist', () => {
- expect(getKiloCount).toBeDefined()
- })
-
- it('should be a callable', () => {
- expect(typeof getKiloCount).toBe('function')
- })
-
- it('should accept 3 arguments', () => {
- expect(getKiloCount).toHaveLength(3)
- })
-
- describe.each`
- hundreds | hundredsName
- ${1} | ${'sandaan'}
- ${2} | ${'dalawandaan'}
- ${3} | ${'tatlongdaan'}
- ${4} | ${'apatnaraan'}
- ${5} | ${'limandaan'}
- ${6} | ${'animnaraan'}
- ${7} | ${'pitongdaan'}
- ${8} | ${'walongdaan'}
- ${9} | ${'siyamnaraan'}
- `('on $hundreds in hundreds place', ({ hundreds, hundredsName }) => {
- describe('on 0 in tens place', () => {
- test.each`
- ones | onesName
- ${0} | ${''}
- ${1} | ${' at isa'}
- ${2} | ${' at dalawa'}
- ${3} | ${' at tatlo'}
- ${4} | ${' at apat'}
- ${5} | ${' at lima'}
- ${6} | ${' at anim'}
- ${7} | ${' at pito'}
- ${8} | ${' at walo'}
- ${9} | ${' at siyam'}
- `(`should return "${hundredsName}$onesName" for ${hundreds}0$ones`, ({ ones, onesName }) => {
- expect(getKiloCount(hundreds, 0, ones)).toBe([hundredsName, onesName].join(''))
- })
- })
-
- describe('on 1 in tens place', () => {
- test.each`
- ones | tenPlusName
- ${0} | ${' at sampu'}
- ${1} | ${' at labing-isa'}
- ${2} | ${' at labindalawa'}
- ${3} | ${' at labintatlo'}
- ${4} | ${' at labing-apat'}
- ${5} | ${' at labinlima'}
- ${6} | ${' at labing-anim'}
- ${7} | ${' at labimpito'}
- ${8} | ${' at labingwalo'}
- ${9} | ${' at labinsiyam'}
- `(`should return "${hundredsName}$tenPlusName" for ${hundreds}1$ones`, ({ ones, tenPlusName }) => {
- expect(getKiloCount(hundreds, 1, ones)).toBe([hundredsName, tenPlusName].join(''))
- })
- })
-
- describe.each`
- tens | tensName
- ${2} | ${' dalawampu'}
- ${3} | ${' tatlumpu'}
- ${4} | ${' apatnapu'}
- ${5} | ${' limampu'}
- ${6} | ${' animnapu'}
- ${7} | ${' pitumpu'}
- ${8} | ${' walumpu'}
- ${9} | ${' siyamnapu'}
- `('on $tens in tens place', ({ tens, tensName }) => {
- it(`should return "${hundredsName} at${tensName}" for ${hundreds}${tens}0`, () => {
- expect(getKiloCount(hundreds, tens, 0)).toBe([hundredsName, tensName].join(' at'))
- })
-
- test.each`
- ones | onesName
- ${1} | ${"'t isa"}
- ${2} | ${"'t dalawa"}
- ${3} | ${"'t tatlo"}
- ${4} | ${"'t apat"}
- ${5} | ${"'t lima"}
- ${6} | ${"'t anim"}
- ${7} | ${"'t pito"}
- ${8} | ${"'t walo"}
- ${9} | ${"'t siyam"}
- `(`should return "${hundredsName}${tensName}$onesName" for ${hundreds}${tens}$ones`, ({ ones, onesName }) => {
- expect(getKiloCount(hundreds, tens, ones)).toBe([hundredsName, tensName, onesName].join(''))
- })
- })
- })
|