Nightscout Plugin (#108)
This commit is contained in:
31
source/app/mocks/api/axios/get/nightscout.mjs
Normal file
31
source/app/mocks/api/axios/get/nightscout.mjs
Normal file
@@ -0,0 +1,31 @@
|
||||
/**Mocked data */
|
||||
export default function({faker, url}) {
|
||||
//Last.fm api
|
||||
if (/^https:..testapp.herokuapp.com.*$/.test(url)) {
|
||||
//Get Nightscout Data
|
||||
console.debug(`metrics/compute/mocks > mocking nightscout api result > ${url}`)
|
||||
const lastInterval = Math.floor(new Date() / 300000) * 300000
|
||||
const directionArray = ["SingleUp", "DoubleUp", "FortyFiveUp", "Flat", "FortyFiveDown", "SingleDown", "DoubleDown"]
|
||||
return ({
|
||||
status:200,
|
||||
data:{
|
||||
data:[{
|
||||
_id:faker.git.commitSha().substring(0, 23),
|
||||
device:"xDrip-DexcomG5",
|
||||
date:lastInterval,
|
||||
dateString:new Date(lastInterval).toISOString(),
|
||||
sgv:faker.random.number({min:40, max:400}),
|
||||
delta:faker.random.number({min:-10, max:10}),
|
||||
direction:directionArray[Math.floor(Math.random() * directionArray.length)],
|
||||
type:"sgv",
|
||||
filtered:0,
|
||||
unfiltered:0,
|
||||
rssi:100,
|
||||
noise:1,
|
||||
sysTime:new Date(lastInterval).toISOString(),
|
||||
utcOffset:faker.random.number({min:-12, max:14})*60,
|
||||
}],
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -257,6 +257,17 @@
|
||||
}))
|
||||
}
|
||||
}) : null),
|
||||
//Nightscout
|
||||
...(set.plugins.enabled.nightscout ? ({
|
||||
nightscout:{
|
||||
url: options["nightscout.url"] != null && options["nightscout.url"] != "https://example.herokuapp.com" ? options["nightscout.url"]: "https://testapp.herokuapp.com/",
|
||||
datapoints: faker.random.number({min: 8, max: 12}),
|
||||
lowalert: faker.random.number({min: 60, max: 90}),
|
||||
highalert: faker.random.number({min: 150, max: 200}),
|
||||
urgentlowalert: faker.random.number({min: 40, max: 59}),
|
||||
urgenthighalert: faker.random.number({min: 201, max: 300})
|
||||
}
|
||||
}) : null),
|
||||
//Pagespeed
|
||||
...(set.plugins.enabled.pagespeed ? ({
|
||||
pagespeed:{
|
||||
|
||||
Reference in New Issue
Block a user