Closed rodolfoghi closed 4 years ago
Implement function format to pass these tests:
format
test('should format CPF with mask', () => { expect(format('')).toBe(''); expect(format('9')).toBe('9'); expect(format('94')).toBe('94'); expect(format('943')).toBe('943'); expect(format('9438')).toBe('943.8'); expect(format('94389')).toBe('943.89'); expect(format('943895')).toBe('943.895'); expect(format('9438957')).toBe('943.895.7'); expect(format('94389575')).toBe('943.895.75'); expect(format('943895751')).toBe('943.895.751'); expect(format('9438957510')).toBe('943.895.751-0'); expect(format('94389575104')).toBe('943.895.751-04'); });
P.S: The code above is written in TypeScript.
In Rust we will have something like this:
#[test] fn should_format_cpf_empty() { assert_eq!(cpf::format(""), ""); }
https://github.com/brazilian-utils/brazilian-utils/blob/master/src/utilities/cpf/index.test.ts
Implement function
format
to pass these tests:P.S: The code above is written in TypeScript.
In Rust we will have something like this: