Add linter and minor bug fixes (#107)

This commit is contained in:
Simon Lecoq
2021-02-05 23:45:48 +01:00
committed by GitHub
parent 61e2f6e1a1
commit 882a93dea5
74 changed files with 1544 additions and 712 deletions

View File

@@ -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),
},
}
},
})
}
}
}
}