Skip to content

Commit

Permalink
test: added test for "type" field always existing
Browse files Browse the repository at this point in the history
  • Loading branch information
grantila committed Aug 25, 2024
1 parent 14a8647 commit 94fcb58
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test.in/awesome-phonenumber/new-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,16 @@ describe( 'errors', ( ) =>
expect( pn.possible ).toBe( false );
expect( pn.possibility ).toBe( 'invalid' );
} );


it( 'invalid phone number should still set type', ( ) => {
const pn = parsePhoneNumber( "0740521234", { regionCode: "US" } );

expect( pn.valid ).toBe( false );
expect( pn.possible ).toBe( false );
expect( pn.possibility ).toBe( 'invalid' );
expect( pn.type ).toBe( 'unknown' );
} );
} );

describe( 'getNumberFrom', ( ) =>
Expand Down

0 comments on commit 94fcb58

Please sign in to comment.