Fix code quality issues
This commit is contained in:
@@ -297,7 +297,7 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
//Commit content
|
//Commit content
|
||||||
if (/api.github.com.repos.lowlighter.metrics.commits.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/.test(url)) {
|
if (/^https:..api.github.com.repos.lowlighter.metrics.commits.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/.test(url)) {
|
||||||
console.debug(`metrics/compute/mocks > mocking rest api result > rest.request ${url}`)
|
console.debug(`metrics/compute/mocks > mocking rest api result > rest.request ${url}`)
|
||||||
return ({
|
return ({
|
||||||
status: 200,
|
status: 200,
|
||||||
@@ -509,7 +509,7 @@
|
|||||||
//Arguments
|
//Arguments
|
||||||
const [url, body] = args
|
const [url, body] = args
|
||||||
//Spotify api
|
//Spotify api
|
||||||
if (/accounts.spotify.com.api.token/.test(url)) {
|
if (/^https:..accounts.spotify.com.api.token/.test(url)) {
|
||||||
//Access token generator
|
//Access token generator
|
||||||
const params = new urls.URLSearchParams(body)
|
const params = new urls.URLSearchParams(body)
|
||||||
if ((params.get("grant_type") === "refresh_token")&&(params.get("client_id") === "MOCKED_CLIENT_ID")&&(params.get("client_secret") === "MOCKED_CLIENT_SECRET")&&(params.get("refresh_token") === "MOCKED_REFRESH_TOKEN")) {
|
if ((params.get("grant_type") === "refresh_token")&&(params.get("client_id") === "MOCKED_CLIENT_ID")&&(params.get("client_secret") === "MOCKED_CLIENT_SECRET")&&(params.get("refresh_token") === "MOCKED_REFRESH_TOKEN")) {
|
||||||
@@ -535,7 +535,7 @@
|
|||||||
//Arguments
|
//Arguments
|
||||||
const [url, options] = args
|
const [url, options] = args
|
||||||
//Pagespeed api
|
//Pagespeed api
|
||||||
if (/googleapis.com.pagespeedonline.v5/.test(url)) {
|
if (/^https:..www.googleapis.com.pagespeedonline.v5/.test(url)) {
|
||||||
//Pagespeed result
|
//Pagespeed result
|
||||||
if (/v5.runPagespeed.*&key=MOCKED_TOKEN/.test(url)) {
|
if (/v5.runPagespeed.*&key=MOCKED_TOKEN/.test(url)) {
|
||||||
console.debug(`metrics/compute/mocks > mocking pagespeed api result > ${url}`)
|
console.debug(`metrics/compute/mocks > mocking pagespeed api result > ${url}`)
|
||||||
@@ -635,7 +635,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Spotify api
|
//Spotify api
|
||||||
if (/api.spotify.com/.test(url)) {
|
if (/^https:..api.spotify.com/.test(url)) {
|
||||||
//Get recently played tracks
|
//Get recently played tracks
|
||||||
if (/me.player.recently-played/.test(url)&&(options?.headers?.Authorization === "Bearer MOCKED_TOKEN_ACCESS")) {
|
if (/me.player.recently-played/.test(url)&&(options?.headers?.Authorization === "Bearer MOCKED_TOKEN_ACCESS")) {
|
||||||
console.debug(`metrics/compute/mocks > mocking spotify api result > ${url}`)
|
console.debug(`metrics/compute/mocks > mocking spotify api result > ${url}`)
|
||||||
@@ -695,7 +695,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Twitter api
|
//Twitter api
|
||||||
if (/api.twitter.com/.test(url)) {
|
if (/^https:..api.twitter.com/.test(url)) {
|
||||||
//Get user profile
|
//Get user profile
|
||||||
if ((/users.by.username/.test(url))&&(options?.headers?.Authorization === "Bearer MOCKED_TOKEN")) {
|
if ((/users.by.username/.test(url))&&(options?.headers?.Authorization === "Bearer MOCKED_TOKEN")) {
|
||||||
console.debug(`metrics/compute/mocks > mocking twitter api result > ${url}`)
|
console.debug(`metrics/compute/mocks > mocking twitter api result > ${url}`)
|
||||||
|
|||||||
@@ -202,7 +202,6 @@
|
|||||||
plugin_habits:true,
|
plugin_habits:true,
|
||||||
plugin_habits_from:5,
|
plugin_habits_from:5,
|
||||||
plugin_habits_charts:true,
|
plugin_habits_charts:true,
|
||||||
plugin_habits_charts:true,
|
|
||||||
}, {skip:["terminal", "repository"]}],
|
}, {skip:["terminal", "repository"]}],
|
||||||
["Gists plugin (default)", {
|
["Gists plugin (default)", {
|
||||||
plugin_gists:true,
|
plugin_gists:true,
|
||||||
@@ -211,7 +210,7 @@
|
|||||||
|
|
||||||
//Tests run
|
//Tests run
|
||||||
describe("GitHub Action", () =>
|
describe("GitHub Action", () =>
|
||||||
describe.skip.each([
|
describe.each([
|
||||||
["classic", {}],
|
["classic", {}],
|
||||||
["terminal", {}],
|
["terminal", {}],
|
||||||
["repository", {repo:"metrics"}],
|
["repository", {repo:"metrics"}],
|
||||||
@@ -235,9 +234,9 @@
|
|||||||
|
|
||||||
describe("Web instance", () =>
|
describe("Web instance", () =>
|
||||||
describe.each([
|
describe.each([
|
||||||
// ["classic", {}],
|
["classic", {}],
|
||||||
["terminal", {}],
|
["terminal", {}],
|
||||||
// ["repository", {repo:"metrics"}],
|
["repository", {repo:"metrics"}],
|
||||||
])("Template : %s", (template, query) => {
|
])("Template : %s", (template, query) => {
|
||||||
for (const [name, input, {skip = []} = {}] of tests)
|
for (const [name, input, {skip = []} = {}] of tests)
|
||||||
if (skip.includes(template))
|
if (skip.includes(template))
|
||||||
|
|||||||
Reference in New Issue
Block a user