Skip to content

Commit

Permalink
Merge branch 'main' into renovate/netlify-edge-bundler-4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
khendrikse authored Nov 17, 2022
2 parents 9cfee4e + f8d8bef commit 2724c4a
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 33 deletions.
82 changes: 50 additions & 32 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"Nestor Vera <nestorvera@me.com> (https://twitter.com/hack_nug)",
"Netlify Team Account 1 (https://twitter.com/netlify)",
"Nick McCurdy <nick@nickmccurdy.com> (https://twitter.com/nickemccurdy)",
"Nick Taylor <nick@iamdeveloper.com> (https://twitter.com/nickytonline)",
"Nicolas Gonzalez",
"Pankaj Patil <pankaj.patil2099@hotmail.com> (https://twitter.com/pankajpatil16)",
"Peter",
Expand Down Expand Up @@ -227,7 +228,7 @@
"prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!**/*/package-lock.json\" \"!.github/**/*.md\""
},
"dependencies": {
"@netlify/build": "^28.1.13",
"@netlify/build": "^28.1.15",
"@netlify/config": "^20.0.0",
"@netlify/edge-bundler": "^4.1.0",
"@netlify/framework-info": "^9.5.1",
Expand Down
9 changes: 9 additions & 0 deletions src/lib/geo-location.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ const REQUEST_TIMEOUT = 1e4
* @property {object} subdivision
* @property {string} subdivision.code
* @property {string} subdivision.name
* @property {number} longitude
* @property {number} latitude
* @property {string} timezone
*/

const mockLocation = {
city: 'San Francisco',
country: { code: 'US', name: 'United States' },
subdivision: { code: 'CA', name: 'California' },
longitude: 0,
latitude: 0,
timezone: 'UTC',
}

/**
Expand Down Expand Up @@ -71,6 +77,9 @@ const getGeoLocation = async ({ geoCountry, mode, offline, state }) => {
city: 'Mock City',
country: { code: geoCountry, name: 'Mock Country' },
subdivision: { code: 'SD', name: 'Mock Subdivision' },
longitude: 0,
latitude: 0,
timezone: 'UTC',
}
}
return mockLocation
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/lib/geo-location.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ test('`getGeoLocation` returns mock geolocation data if valid country code set',
city: 'Mock City',
country: { code: 'CA', name: 'Mock Country' },
subdivision: { code: 'SD', name: 'Mock Subdivision' },
latitude: 0,
longitude: 0,
timezone: 'UTC',
}

const mockState = {
Expand All @@ -144,6 +147,9 @@ test('`getGeoLocation` mocks country code when not using mock flag', async (t) =
city: 'Mock City',
country: { code: 'CA', name: 'Mock Country' },
subdivision: { code: 'SD', name: 'Mock Subdivision' },
latitude: 0,
longitude: 0,
timezone: 'UTC',
}

const geo = await getGeoLocation({ mode: 'update', offline: false, state: mockState, geoCountry: 'CA' })
Expand Down

0 comments on commit 2724c4a

Please sign in to comment.