mirror of
https://github.com/node-red/node-red.git
synced 2025-12-27 15:34:26 +01:00
Add unit tests
This commit is contained in:
@@ -106,16 +106,16 @@ function isTelemetryEnabled () {
|
||||
return undefined
|
||||
}
|
||||
|
||||
// If there are telemetry settings, use what it says
|
||||
if (telemetrySettings && telemetrySettings.enabled !== undefined) {
|
||||
return telemetrySettings.enabled
|
||||
}
|
||||
|
||||
// User has made a choice; defer to that
|
||||
if (runtimeTelemetryEnabled !== undefined) {
|
||||
return runtimeTelemetryEnabled
|
||||
}
|
||||
|
||||
// If there are telemetry settings, use what it says
|
||||
if (telemetrySettings && telemetrySettings.enabled !== undefined) {
|
||||
return telemetrySettings.enabled
|
||||
}
|
||||
|
||||
// At this point, we have no sign the user has consented to telemetry, so
|
||||
// keep disabled - but return undefined as a false-like value to distinguish
|
||||
// it from the explicit disable above
|
||||
@@ -157,6 +157,7 @@ function stopTelemetry () {
|
||||
module.exports = {
|
||||
init: (_runtime) => {
|
||||
runtime = _runtime
|
||||
|
||||
if (isTelemetryEnabled()) {
|
||||
startTelemetry()
|
||||
}
|
||||
@@ -185,5 +186,12 @@ module.exports = {
|
||||
* Get telemetry enabled status
|
||||
* @returns {boolean} true if telemetry is enabled, false if disabled, undefined if not set
|
||||
*/
|
||||
isEnabled: isTelemetryEnabled
|
||||
isEnabled: isTelemetryEnabled,
|
||||
|
||||
stop: () => {
|
||||
if (scheduleTask) {
|
||||
scheduleTask.stop()
|
||||
scheduleTask = null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
const process = require('process')
|
||||
|
||||
module.exports = async (runtime) => {
|
||||
module.exports = (runtime) => {
|
||||
return {
|
||||
'env.nodejs': process.version.replace(/^v/, ''),
|
||||
'env.node-red': runtime.settings.version
|
||||
|
||||
Reference in New Issue
Block a user