1 import { type CardModel, isPostalCode, toDetails } from './cardDetails';
3 describe('postal code', () => {
4 it('should validate invalid postal code', () => {
5 expect(isPostalCode('')).toBe(false);
6 expect(isPostalCode('1')).toBe(false);
7 expect(isPostalCode('12')).toBe(false);
10 it('should validate us postal code', () => {
11 expect(isPostalCode('CA95014')).toBe(true);
14 it('should validate polish postal code', () => {
15 expect(isPostalCode('31-444')).toBe(true);
19 describe('cardDetails', () => {
20 it('should format card details correctly', () => {
21 let card: CardModel = {
22 number: '4111 1111 1111 1111',
30 expect(toDetails(card)).toEqual({
31 Number: '4111111111111111',
40 number: '4111 1111 1111 1111',
48 expect(toDetails(card)).toEqual({
49 Number: '4111111111111111',