You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there 👋
I've seen that two examples from your readme are not producing the denoted results:
"You can overwrite the country code incoming from the map service"
"You can use a fallback to keep the library working when the country code is wrong"
I have attached a test for all examples from the readme which you can just put into your test/ directory:
/* eslint-disable camelcase */importaddressFormatterfrom'../src/index';describe('Examples from README.md',()=>{describe('Basic examples',()=>{it('first',()=>{constformatted=addressFormatter.format({"houseNumber": 301,"road": "Hamilton Avenue","neighbourhood": "Crescent Park","city": "Palo Alto","postcode": 94303,"county": "Santa Clara County","state": "California","country": "United States of America","countryCode": "US",});expect(formatted).toBe(`301 Hamilton AvenuePalo Alto, CA 94303United States of America`);});it('second',()=>{constformat=addressFormatter.format({"houseNumber": 301,"road": "Hamilton Avenue","neighbourhood": "Crescent Park","city": "Palo Alto","postcode": 94303,"county": "Santa Clara County","state": "California","countryCode": "US",},{appendCountry: true});expect(format).toBe(`301 Hamilton AvenuePalo Alto, CA 94303United States of America`);});})it('You can overwrite the country code incoming from the map service',()=>{constformat=addressFormatter.format({"houseNumber": 301,"road": "Hamilton Avenue","neighbourhood": "Crescent Park","city": "Palo Alto","postcode": 94303,"county": "Santa Clara County","state": "California","country": "United States of America","countryCode": "US",},{abbreviate: true,countryCode: 'UK'});expect(format).toBe(`301 Hamilton AvePalo Alto 94303USA`);});it('You can use a fallback to keep the library working when the country code is wrong',()=>{constformat=addressFormatter.format({"houseNumber": 301,"road": "Hamilton Avenue","neighbourhood": "Crescent Park","city": "Palo Alto","postcode": 94303,"county": "Santa Clara County","state": "California","country": "United States of America","countryCode": "yu",},{abbreviate: true,fallbackCountryCode: 'UK'});expect(format).toBe(`301 Hamilton AvePalo Alto 94303USA`);});it('You can get the address as a list of lines to make your formatting easier',()=>{constformat=addressFormatter.format({"houseNumber": 301,"road": "Hamilton Avenue","neighbourhood": "Crescent Park","city": "Palo Alto","postcode": 94303,"county": "Santa Clara County","state": "California","country": "United States of America","countryCode": "US",},{output: 'array'});expect(format).toEqual(['301 Hamilton Avenue','Palo Alto, CA 94303','United States of America']);});});
The text was updated successfully, but these errors were encountered:
Hi there 👋
I've seen that two examples from your readme are not producing the denoted results:
I have attached a test for all examples from the readme which you can just put into your
test/
directory:The text was updated successfully, but these errors were encountered: