feat(plugins/stargazers): add worldmap (#1137) [skip ci]
This commit is contained in:
@@ -13,3 +13,12 @@
|
||||
plugin_stargazers_charts_type: chartist
|
||||
use_mocked_data: 'yes'
|
||||
verify: 'yes'
|
||||
- name: ✨ Stargazers over last weeks - With worldmap
|
||||
uses: lowlighter/metrics@latest
|
||||
with:
|
||||
token: MOCKED_TOKEN
|
||||
plugin_stargazers: 'yes'
|
||||
plugin_stargazers_worldmap: 'yes'
|
||||
plugin_stargazers_worldmap_token: MOCKED_TOKEN
|
||||
use_mocked_data: 'yes'
|
||||
verify: 'yes'
|
||||
|
||||
@@ -15,6 +15,9 @@ export default function({faker, query, login = faker.internet.userName()}) {
|
||||
edges: new Array(faker.datatype.number({min: 50, max: 100})).fill(null).map(() => ({
|
||||
starredAt: `${faker.date.recent(30)}`,
|
||||
cursor: "MOCKED_CURSOR",
|
||||
node:{
|
||||
location: faker.address.city(),
|
||||
}
|
||||
})),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -5,6 +5,7 @@ import fs from "fs/promises"
|
||||
import paths from "path"
|
||||
import rss from "rss-parser"
|
||||
import urls from "url"
|
||||
import {Client as Gmap} from "@googlemaps/google-maps-services-js"
|
||||
|
||||
//Mocked state
|
||||
let mocked = false
|
||||
@@ -146,6 +147,56 @@ export default async function({graphql, rest}) {
|
||||
}
|
||||
}
|
||||
|
||||
//Google API mocking
|
||||
{
|
||||
//Unmocked
|
||||
console.debug("metrics/compute/mocks > mocking google-maps-services-js")
|
||||
|
||||
//Mock geocode API
|
||||
Gmap.prototype.geocode = function() {
|
||||
console.debug("metrics/compute/mocks > mocking google maps geocode result")
|
||||
const lat = faker.address.latitude()
|
||||
const lng = faker.address.longitude()
|
||||
const city = faker.address.city()
|
||||
const country = faker.address.country()
|
||||
return {
|
||||
data:{
|
||||
results:[
|
||||
{
|
||||
address_components: [
|
||||
{
|
||||
long_name: city,
|
||||
short_name: city,
|
||||
types: [ "political" ]
|
||||
},
|
||||
{
|
||||
long_name: country,
|
||||
short_name: faker.address.countryCode(),
|
||||
types: [ "country", "political" ]
|
||||
}
|
||||
],
|
||||
formatted_address: `${city}, ${country}`,
|
||||
geometry: {
|
||||
bounds: {
|
||||
northeast: { lat, lng },
|
||||
southwest: { lat, lng }
|
||||
},
|
||||
location: { lat, lng },
|
||||
location_type: "APPROXIMATE",
|
||||
viewport: {
|
||||
northeast: { lat, lng },
|
||||
southwest: { lat, lng }
|
||||
}
|
||||
},
|
||||
place_id: 'ChIJu9FC7RXupzsR26dsAapFLgg',
|
||||
types: [ "locality", "political" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Return mocked elements
|
||||
return {graphql, rest}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"NIGHTSCOUT_URL":"https://testapp.herokuapp.com/",
|
||||
"WAKATIME_TOKEN":"MOCKED_TOKEN",
|
||||
"TWITTER_TOKEN":"MOCKED_TOKEN",
|
||||
"GOOGLE_MAP_TOKEN": "MOCKED_TOKEN",
|
||||
"STOCK_TOKEN":"MOCKED_TOKEN",
|
||||
"POOPMAP_TOKEN":"MOCKED_TOKEN"
|
||||
}
|
||||
Reference in New Issue
Block a user