Fix svg height, add conversion options and options to use differents data from GitHub account (#35)
* Display all features on web instance but disable them when they're not enabled * Resize dynamically SVG output and add support to convert images to jpeg/png * Disable animations when computing height * Add option to disable animations * Add options to specify different data from used GitHub account * Update tests
This commit is contained in:
@@ -31,37 +31,66 @@
|
||||
//Web instance
|
||||
const web = {}
|
||||
web.run = async (vars) => (await axios(`http://localhost:3000/lowlighter?${new url.URLSearchParams(Object.fromEntries(Object.entries(vars).map(([key, value]) => [key.replace(/^plugin_/, "").replace(/_/g, "."), value])))}`)).status === 200
|
||||
beforeAll(async () => await new Promise((solve, reject) => {
|
||||
let stdout = ""
|
||||
web.instance = processes.spawn("node", ["source/app/web/index.mjs"], {env:{...process.env, USE_MOCKED_DATA:true}})
|
||||
web.instance.stdout.on("data", data => (stdout += data, /Server ready !/.test(stdout) ? solve() : null))
|
||||
web.instance.stderr.on("data", data => console.error(`${data}`))
|
||||
}))
|
||||
afterAll(async () => await web.instance.kill())
|
||||
beforeAll(async done => {
|
||||
await new Promise((solve, reject) => {
|
||||
let stdout = ""
|
||||
web.instance = processes.spawn("node", ["source/app/web/index.mjs"], {env:{...process.env, USE_MOCKED_DATA:true, NO_SETTINGS:true}})
|
||||
web.instance.stdout.on("data", data => (stdout += data, /Server ready !/.test(stdout) ? solve() : null))
|
||||
web.instance.stderr.on("data", data => console.error(`${data}`))
|
||||
})
|
||||
done()
|
||||
})
|
||||
afterAll(async done => {
|
||||
await web.instance.kill("SIGKILL")
|
||||
done()
|
||||
})
|
||||
|
||||
//Test cases
|
||||
const tests = [
|
||||
["Base (header)", {
|
||||
base:"header"
|
||||
base:"header",
|
||||
base_header:true,
|
||||
}],
|
||||
["Base (activity", {
|
||||
base:"activity"
|
||||
base:"activity",
|
||||
base_activity:true,
|
||||
}],
|
||||
["Base (community)", {
|
||||
base:"community"
|
||||
base:"community",
|
||||
base_community:true,
|
||||
}],
|
||||
["Base (repositories)", {
|
||||
base:"repositories"
|
||||
base:"repositories",
|
||||
base_repositories:true,
|
||||
}],
|
||||
["Base (metadata)", {
|
||||
base:"metadata"
|
||||
base:"metadata",
|
||||
base_metadata:true,
|
||||
}],
|
||||
["Base (complete)", {
|
||||
base:"header, activity, community, repositories, metadata"
|
||||
base:"header, activity, community, repositories, metadata",
|
||||
base_header:true,
|
||||
base_activity:true,
|
||||
base_community:true,
|
||||
base_repositories:true,
|
||||
base_metadata:true,
|
||||
}],
|
||||
["Image output (jpeg)", {
|
||||
config_output:"jpeg",
|
||||
}],
|
||||
["Image output (png)", {
|
||||
config_output:"png",
|
||||
}],
|
||||
["Disable animations", {
|
||||
config_animations:"no",
|
||||
}],
|
||||
["PageSpeed plugin (default)", {
|
||||
plugin_pagespeed:true,
|
||||
}, {skip:["repository"]}],
|
||||
["PageSpeed plugin (different url)", {
|
||||
plugin_pagespeed:true,
|
||||
plugin_pagespeed_url:"github.com",
|
||||
}, {skip:["repository"]}],
|
||||
["PageSpeed plugin (detailed)", {
|
||||
plugin_pagespeed:true,
|
||||
plugin_pagespeed_detailed:true,
|
||||
@@ -179,6 +208,10 @@
|
||||
["Tweets plugin (default)", {
|
||||
plugin_tweets:true,
|
||||
}, {skip:["terminal", "repository"]}],
|
||||
["Tweets plugin (different user)", {
|
||||
plugin_tweets:true,
|
||||
plugin_tweets_user:"twitterdev",
|
||||
}, {skip:["terminal", "repository"]}],
|
||||
["Posts plugin (dev.to)", {
|
||||
user:"lowlighter",
|
||||
plugin_posts:true,
|
||||
|
||||
Reference in New Issue
Block a user