Add linter and minor bug fixes (#107)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/** Mocked data */
|
||||
export default function ({faker, url, options, login = faker.internet.userName()}) {
|
||||
/**Mocked data */
|
||||
export default function({faker, url, options, login = faker.internet.userName()}) {
|
||||
//Last.fm api
|
||||
if (/^https:..ws.audioscrobbler.com.*$/.test(url)) {
|
||||
//Get recently played tracks
|
||||
@@ -63,4 +63,4 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Mocked data */
|
||||
export default function ({faker, url, options, login = faker.internet.userName()}) {
|
||||
/**Mocked data */
|
||||
export default function({faker, url, options, login = faker.internet.userName()}) {
|
||||
//Tested url
|
||||
const tested = url.match(/&url=(?<tested>.*?)(?:&|$)/)?.groups?.tested ?? faker.internet.url()
|
||||
//Pagespeed api
|
||||
@@ -20,17 +20,17 @@
|
||||
"final-screenshot":{
|
||||
id:"final-screenshot",
|
||||
title:"Final Screenshot",
|
||||
score: null,
|
||||
score:null,
|
||||
details:{
|
||||
data:"data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
|
||||
type:"screenshot",
|
||||
timestamp:Date.now()
|
||||
}
|
||||
timestamp:Date.now(),
|
||||
},
|
||||
},
|
||||
metrics:{
|
||||
id:"metrics",
|
||||
title:"Metrics",
|
||||
score: null,
|
||||
score:null,
|
||||
details:{
|
||||
items:[
|
||||
{
|
||||
@@ -68,9 +68,9 @@
|
||||
interactive:faker.random.number(1000),
|
||||
observedNavigationStartTs:faker.time.recent(),
|
||||
observedNavigationStart:faker.random.number(10),
|
||||
observedFirstMeaningfulPaintTs:faker.time.recent()
|
||||
observedFirstMeaningfulPaintTs:faker.time.recent(),
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -90,16 +90,16 @@
|
||||
title:"Accessibility",
|
||||
score:faker.random.float({max:1}),
|
||||
},
|
||||
performance: {
|
||||
performance:{
|
||||
id:"performance",
|
||||
title:"Performance",
|
||||
score:faker.random.float({max:1}),
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
analysisUTCTimestamp:`${faker.date.recent()}`,
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Mocked data */
|
||||
export default function ({faker, url, options, login = faker.internet.userName()}) {
|
||||
/**Mocked data */
|
||||
export default function({faker, url, options, login = faker.internet.userName()}) {
|
||||
//Spotify api
|
||||
if (/^https:..api.spotify.com.*$/.test(url)) {
|
||||
//Get recently played tracks
|
||||
@@ -19,24 +19,24 @@
|
||||
{
|
||||
name:artist,
|
||||
type:"artist",
|
||||
}
|
||||
},
|
||||
],
|
||||
images:[
|
||||
{
|
||||
height:640,
|
||||
url:faker.image.abstract(),
|
||||
width:640
|
||||
width:640,
|
||||
},
|
||||
{
|
||||
height:300,
|
||||
url:faker.image.abstract(),
|
||||
width:300
|
||||
width:300,
|
||||
},
|
||||
{
|
||||
height:64,
|
||||
url:faker.image.abstract(),
|
||||
width:64
|
||||
}
|
||||
width:64,
|
||||
},
|
||||
],
|
||||
name:track,
|
||||
release_date:`${faker.date.past()}`.substring(0, 10),
|
||||
@@ -46,7 +46,7 @@
|
||||
{
|
||||
name:artist,
|
||||
type:"artist",
|
||||
}
|
||||
},
|
||||
],
|
||||
name:track,
|
||||
preview_url:faker.internet.url(),
|
||||
@@ -55,11 +55,11 @@
|
||||
played_at:`${faker.date.recent()}`,
|
||||
context:{
|
||||
type:"album",
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** Mocked data */
|
||||
export default function ({faker, url, options, login = faker.internet.userName()}) {
|
||||
/**Mocked data */
|
||||
export default function({faker, url, options, login = faker.internet.userName()}) {
|
||||
//Twitter api
|
||||
if (/^https:..api.twitter.com.*$/.test(url)) {
|
||||
//Get user profile
|
||||
@@ -16,7 +16,7 @@
|
||||
id:faker.random.number(1000000).toString(),
|
||||
username,
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
//Get recent tweets
|
||||
@@ -40,7 +40,7 @@
|
||||
id:faker.random.number(100000000000000).toString(),
|
||||
created_at:`${faker.date.recent()}`,
|
||||
text:faker.lorem.paragraph(),
|
||||
}
|
||||
},
|
||||
],
|
||||
includes:{
|
||||
users:[
|
||||
@@ -49,7 +49,7 @@
|
||||
name:"lowlighter",
|
||||
username:"lowlighter",
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
meta:{
|
||||
newest_id:faker.random.number(100000000000000).toString(),
|
||||
@@ -57,8 +57,8 @@
|
||||
result_count:2,
|
||||
next_token:"MOCKED_CURSOR",
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
/** Mocked data */
|
||||
export default function ({faker, url, options, login = faker.internet.userName()}) {
|
||||
/**Mocked data */
|
||||
export default function({faker, url, options, login = faker.internet.userName()}) {
|
||||
//Wakatime api
|
||||
if (/^https:..wakatime.com.api.v1.users.current.stats.*$/.test(url)) {
|
||||
//Get user profile
|
||||
if (/api_key=MOCKED_TOKEN/.test(url)) {
|
||||
console.debug(`metrics/compute/mocks > mocking wakatime api result > ${url}`)
|
||||
const stats = (array) => {
|
||||
const stats = array => {
|
||||
const elements = []
|
||||
let results = new Array(4+faker.random.number(2)).fill(null).map(_ => ({
|
||||
get digital() { return `${this.hours}:${this.minutes}` },
|
||||
get digital() {
|
||||
return `${this.hours}:${this.minutes}`
|
||||
},
|
||||
hours:faker.random.number(1000), minutes:faker.random.number(1000),
|
||||
name:array ? faker.random.arrayElement(array) : faker.random.words(2).replace(/ /g, "-").toLocaleLowerCase(),
|
||||
percent:0, total_seconds:faker.random.number(1000000),
|
||||
@@ -43,8 +45,8 @@
|
||||
total_seconds:faker.random.number(1000000000),
|
||||
total_seconds_including_other_language:faker.random.number(1000000000),
|
||||
},
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user