Skip to content

upgrade eslint

upgrade eslint #727

GitHub Actions / Unit Test report 18.x succeeded Mar 29, 2024 in 0s

253 passed, 0 failed and 0 skipped

Tests passed successfully

✅ report_unit.json

253 tests were completed in 7s with 253 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
test/unittests/addons/addon.js 18✅ 17ms
test/unittests/addons/dynamic-router.js 2✅ 0ms
test/unittests/addons/index.js 12✅ 3ms
test/unittests/controller/builds.js 6✅ 4ms
test/unittests/controller/campaigns.js 1✅ 0ms
test/unittests/controller/events.js 7✅ 61ms
test/unittests/controller/groups.js 1✅ 0ms
test/unittests/controller/index.js 10✅ 74ms
test/unittests/controller/items.js 4✅ 12ms
test/unittests/controller/loans.js 3✅ 44ms
test/unittests/controller/resources.js 9✅ 19ms
test/unittests/controller/results.js 8✅ 53ms
test/unittests/controller/schemas.js 6✅ 1ms
test/unittests/controller/testcases.js 1✅ 0ms
test/unittests/controller/users.js 22✅ 160ms
test/unittests/master.js 38✅ 651ms
test/unittests/routes/builds.js 2✅ 2ms
test/unittests/routes/schemas.js 2✅ 2ms
test/unittests/tools/eventbus/cluster-event-bus.js 7✅ 2ms
test/unittests/tools/eventbus/event.js 9✅ 1ms
test/unittests/tools/eventbus/index-file.js 5✅ 1ms
test/unittests/tools/eventbus/local-event-bus.js 4✅ 0ms
test/unittests/tools/filedb.js 24✅ 21ms
test/unittests/tools/update/gitUpdater.js 25✅ 16ms
test/unittests/tools/update/index.js 1✅ 0ms
test/unittests/tools/update/npm.js 9✅ 2ms
test/unittests/tools/update/npmUpdater.js 2✅ 1ms
test/unittests/tools/update/updater.js 9✅ 5ms
test/unittests/tools/utilization.js 6✅ 5ms

✅ test/unittests/addons/addon.js

addon.js _checkDependencies
  ✅ _checkDependencies - resolvable dependencies
addon.js _checkDependency
  ✅ _checkDependency - valid dependency
addon.js _installDependencies
  ✅ _installDependencies
addon.js _loadAddonModule
  ✅ _loadAddonModule
addon.js _registerRouter
  ✅ _registerRouter - instance has router
addon.js _registerStaticPath
  ✅ _registerStaticPath - has static path
addon.js _requireModule
  ✅ _requireModule
addon.js _requirePackageFile
  ✅ _requirePackageFile
addon.js createInstance
  ✅ createInstance - correct state, no errors
addon.js isBusy
  ✅ isBusy - true and false case
addon.js isLoaded
  ✅ isLoaded - valid state
addon.js isRegistered
  ✅ isRegistered - valid state
addon.js loadModule
  ✅ loadModule - correct state, no errors
addon.js register
  ✅ register - valid register sequence
addon.js safeToRemove
  ✅ isRegistered - valid state
addon.js Status
  ✅ Status - valid state
addon.js toJson
  ✅ toJson - uncorrupted addon
addon.js unregister
  ✅ unregister - 

✅ test/unittests/addons/dynamic-router.js

dynamic-router.js removeRouter
  ✅ removeRouter - existing router
dynamic-router.js router
  ✅ router - iterate over 5 routers

✅ test/unittests/addons/index.js

addons/index.js _asyncLoad
  ✅ _asyncLoad -  5 addons
addons/index.js _moduleLoadError
  ✅ _moduleLoadError - valid error
addons/index.js _recursiveLoad
  ✅ _recursiveLoad - 5 addons
addons/index.js constructor
  ✅ constructor - created successfully
addons/index.js findAddon
  ✅ findAddon - existing addon
addons/index.js findAddonIndex
  ✅ findAddonIndex - existing addon
addons/index.js init
  ✅ init - valid app, server, and io
addons/index.js loadAddons
  ✅ loadAddons - recursive 2 valid addons
addons/index.js registerAddon
  ✅ registerAddon - valid addon
addons/index.js registerAddons
  ✅ registerAddons - valid addons
addons/index.js removeAddon
  ✅ removeAddon - existing addon
addons/index.js unregisterAddon
  ✅ unregisterAddon - valid addon

✅ test/unittests/controller/builds.js

controllers/builds.js BuildsController
  ✅ should define correct interface on static level
controllers/builds.js BuildsController download
  ✅ should call getFile and send that result to client
  ✅ should catch error thrown by getFile and pipe it to next
controllers/builds.js BuildsController indexParam
  ✅ should assign numeric Index to request root
  ✅ should return error when Index is unparsable
controllers/builds.js exports
  ✅ should export a class named BuildsController

✅ test/unittests/controller/campaigns.js

controllers/campaigns.js
  ✅ constructor

✅ test/unittests/controller/events.js

controllers/events.js
  ✅ constructor
controllers/events.js operate create resource event
  ✅ require ref
  ✅ success
controllers/events.js operate redirectRef
  ✅ found
  ✅ not found
controllers/events.js operate resourceEvents
  ✅ allow to use hw.sn
  ✅ list

✅ test/unittests/controller/groups.js

controllers/groups.js
  ✅ constructor

✅ test/unittests/controller/index.js

controllers/index.js
  ✅ all
  ✅ create
  ✅ defaultModelParam
  ✅ find
  ✅ get
  ✅ isEmpty cb
  ✅ isEmpty promise
  ✅ Model - getter
  ✅ remove
  ✅ update

✅ test/unittests/controller/items.js

controllers/items.js
  ✅ _handleUpdateAvailable
  ✅ _handleUpdateInStock
  ✅ getImage
  ✅ update

✅ test/unittests/controller/loans.js

controllers/loans.js
  ✅ _handleItemsInUpdate
  ✅ findUsersLoans
  ✅ update

✅ test/unittests/controller/resources.js

controllers/resources.js
  ✅ alloc
  ✅ allocMultiple
  ✅ custom modelParam
  ✅ getToBody
  ✅ paramAlloc
  ✅ release
  ✅ releaseMultiple
  ✅ setDeviceBuild
  ✅ solveRoute

✅ test/unittests/controller/results.js

controllers/results.js buildDownload
  ✅ should call getBuildRef and redirect to build route
controllers/results.js createFromJunitXml
  ✅ should be rejected when handleJunitXml is rejected
  ✅ should be rejected when streamToString is rejected
  ✅ should result in ok
controllers/results.js handleJunitXml
  ✅ should be rejected when input is invalid xml
  ✅ should be rejected when input is not JunitXml
  ✅ should result in message created 2 results
controllers/results.js streamToString
  ✅ should concat streamed data correctly

✅ test/unittests/controller/schemas.js

controllers/schemas.js find
  ✅ find - no request params
  ✅ find - no Schema
  ✅ find - should return schema data
controllers/schemas.js get
  ✅ get - should return the schemaNames defined in the controller
controllers/schemas.js paramCollection
  ✅ paramCollection - should set Schema of req
  ✅ paramCollection - unknown collection name

✅ test/unittests/controller/testcases.js

controllers/testcases.js
  ✅ constructor

✅ test/unittests/controller/users.js

controllers/users controller
  ✅ create failed
  ✅ create success
  ✅ ok
controllers/users controller password
  ✅ changePassword
  ✅ changePassword with invalid token
  ✅ changePassword without token
  ✅ forgotPassword
  ✅ forgotPassword email not exists
  ✅ forgotPassword invalid email
controllers/users controller settings
  ✅ deleteSettings, exists
  ✅ deleteSettings, not exists
  ✅ getSettings, exists
  ✅ getSettings, not exists
  ✅ updateSettings
  ✅ updateSettings, already reported
  ✅ updateSettings, failed
controllers/users model
  ✅ allow to add to group and remove from group
  ✅ do not duplicate users in same group
  ✅ isAdmin
  ✅ reject to remove from group if not included
controllers/users model password
  ✅ can change password
  ✅ salt password by default

✅ test/unittests/master.js

app/master.js activateFileListener
  ✅ should emit systemRestartNeeded when master file changed
  ✅ should emit workerRestartEvent when a worker file is edited
  ✅ should not trigger restarts with unlistened events
app/master.js broadcastHandler
  ✅ should not throw errors with valid params
app/master.js createFileListener
  ✅ should return an object that provides emitter functionality
app/master.js deactivateFileListener
  ✅ should call removeAllListeners
app/master.js forkWorker
  ✅ should call fork
  ✅ should redirect message from worker to onWorkerMessage
  ✅ should reject promise on early exit
app/master.js getStats
  ✅ should return object with valid fields
app/master.js handleSIGINT
  ✅ should kill all workers
app/master.js handleWorkerExit
  ✅ should fork new worker when exit was not voluntary
  ✅ should not fork new worker when exit is voluntary
app/master.js handleWorkerRestart
  ✅ should call reloadAllWorkers
app/master.js initialize
  ✅ should call createFileListener and activateFileListener when auto-reload is true
  ✅ should call fork os.cpus().length times
  ✅ should listen for eventBus events
  ✅ should listen for process and cluster events
  ✅ should not call createFileListener and activateFileListener when auto-reload is false
app/master.js killAllWorkers
  ✅ should call kill for all workers defined in the cluster
app/master.js killWorker
  ✅ should catch kill exception
  ✅ should give second chance to kill worker with SIGTERM
  ✅ should give third chance to kill worker with SIGKILL
  ✅ should kill worker when SIGINT success
  ✅ should reject if cannot kill worker
app/master.js logMasterDeath
  ✅ should return 0 with success code
  ✅ should return 1 with no signal and a nonzero code
  ✅ should return 2 with signal
app/master.js logWorkerDeath
  ✅ should return 0 with success code
  ✅ should return 1 with no signal and a nonzero code
  ✅ should return 2 with signal
app/master.js onWorkerMessage
  ✅ should pass event message to correct handler
  ✅ should throw error with missing message type
  ✅ should throw error with unknown message type
app/master.js reloadAllWorkers
  ✅ should call reload for all workers defined in the cluster
app/master.js reloadWorker
  ✅ should kill worker and fork a new one
app/master.js statusHandler
  ✅ should emit event (data.id) with (Master.getStats()) data
  ✅ should not throw error when no id defined

✅ test/unittests/routes/builds.js

routes/builds.js Route
  ✅ should define a parameter handler for Build parameter
  ✅ should define correct routes

✅ test/unittests/routes/schemas.js

routes/schemas.js Route
  ✅ should define a parameter handler for Collection parameter
  ✅ should define correct routes

✅ test/unittests/tools/eventbus/cluster-event-bus.js

eventBus/cluster-event-bus.js emit
  ✅ should not send event to worker that is not connected
  ✅ should send event to all workers
  ✅ should send event to master if process is a worker
eventBus/cluster-event-bus.js exports
  ✅ should define emit function
  ✅ should define forward function
eventBus/cluster-event-bus.js forward
  ✅ should do nothing if the process is not the master
  ✅ should forward event to all workers in cluster expect the sender

✅ test/unittests/tools/eventbus/event.js

eventBus/event.js Event constructor
  ✅ should create an event with valid parameters
  ✅ should throw error when meta is not an object
  ✅ should throw error when type is not valid
eventBus/event.js Event fromObject
  ✅ should create a new event from valid object
  ✅ should throw error when meta is not an object
  ✅ should throw error when type is not valid
eventBus/event.js Event toJSON
  ✅ should return object with all the fields from Event class
eventBus/event.js Event toString
  ✅ should format data as intended
eventBus/event.js exports
  ✅ should expose Event class

✅ test/unittests/tools/eventbus/index-file.js

tools/eventBus clusterEventHandler
  ✅ should add worker id to the events meta
  ✅ should emit/forward message to local and cluster busses
  ✅ should only emit to localbus if process is a worker.
tools/eventBus emit
  ✅ should emit message to both local and cluster bus
tools/eventBus exports
  ✅ should expose proper functions

✅ test/unittests/tools/eventbus/local-event-bus.js

eventBus/local-event-bus.js exports
  ✅ should exports class named LocalEventBus
eventBus/local-event-bus.js LocalEventBus _broadcast
  ✅ should emit event to "*" channel
eventBus/local-event-bus.js LocalEventBus _internal
  ✅ should emit event to "event.name" channel
eventBus/local-event-bus.js LocalEventBus emit
  ✅ should call _broadcast and _internal

✅ test/unittests/tools/filedb.js

tools/filedb.js _checkFilenameAvailability
  ✅ _checkFilenameAvailability - available
  ✅ _checkFilenameAvailability - unavailable
tools/filedb.js _compress
  ✅ _compress - no data
  ✅ _compress - valid data
tools/filedb.js _readFile
  ✅ _readFile - no filename
  ✅ _readFile - nonexistent file
  ✅ _readFile - valid files
tools/filedb.js _resolveFilePath
  ✅ _resolveFilePath - no filename
  ✅ _resolveFilePath - valid filename
tools/filedb.js _uncompress
  ✅ _uncompress - no data
  ✅ _uncompress - valid data
tools/filedb.js _writeFile
  ✅ _writeFile - no data
  ✅ _writeFile - no filename
  ✅ _writeFile - valid files
tools/filedb.js readFile
  ✅ readFile - compress is rejected
  ✅ readFile - file not an instance of File
  ✅ readFile - read is rejected
  ✅ readFile - valid file
tools/filedb.js storeFile
  ✅ storeFile - compress is rejected
  ✅ storeFile - name already taken
  ✅ storeFile - not an instance
  ✅ storeFile - unresolvable checksum
  ✅ storeFile - valid files
  ✅ storeFile - write is rejected

✅ test/unittests/tools/update/gitUpdater.js

update/gitUpdater exports
  ✅ should expose a class named GitUpdater
update/gitUpdater GitUpdater _checkout
  ✅ should call exec with correct command
  ✅ should throw error when exec fails
update/gitUpdater GitUpdater _clean
  ✅ should call exec with correct command
  ✅ should throw error when exec fails
update/gitUpdater GitUpdater _commitId
  ✅ should call exec with correct command
  ✅ should throw error when exec fails
update/gitUpdater GitUpdater _fetch
  ✅ should call exec with correct command
  ✅ should throw error when exec fails
update/gitUpdater GitUpdater _isClean
  ✅ should call exec with correct command
  ✅ should throw error if exec fails
update/gitUpdater GitUpdater _reset
  ✅ should call exec with correct command and custom options
  ✅ should call exec with correct command and default options
  ✅ should throw error when exec fails
update/gitUpdater GitUpdater _tag
  ✅ should call exec with correct command
  ✅ should return undefined tag when exec fails
update/gitUpdater GitUpdater _update
  ✅ should call functions in the right order
  ✅ should call reset if not clean
  ✅ should fail if _checkout fails
  ✅ should fail if clean fails
  ✅ should fail if install fails
  ✅ should fail if reset fails
update/gitUpdater GitUpdater constructor
  ✅ should define right properties with no parameters
  ✅ should define right properties with parameters
update/gitUpdater GitUpdater version
  ✅ should fetch git version and combine it with super.version

✅ test/unittests/tools/update/index.js

update/index.js exports
  ✅ should export valid GitUpdater class

✅ test/unittests/tools/update/npm.js

update/npm.js exports
  ✅ should be a class named Npm
  ✅ should define intended functions
update/npm.js Npm install
  ✅ should catch error thrown in exec
  ✅ should execute a command with specified options - custom install options
  ✅ should execute a command with specified options - default install options
update/npm.js Npm list
  ✅ should be rejected when execute fails
  ✅ should execute list a command with specified options
update/npm.js Npm version
  ✅ should be rejected when execute fails
  ✅ should execute version a command with specified options

✅ test/unittests/tools/update/npmUpdater.js

update/npmUpdater.js exports
  ✅ should expose a class with name NpmUpdater
update/npmUpdater.js NpmUpdater version
  ✅ should call super version

✅ test/unittests/tools/update/updater.js

update/updater.js exports
  ✅ should expose a class with name Updater
update/updater.js Updater constructor
  ✅ should assign options from constructor properties
  ✅ should define intended properties
update/updater.js Updater update
  ✅ should call _revert when update fails
  ✅ should call functions in the right order with right parameters
  ✅ should raise correct error when _revert fails
  ✅ should reject update request when _pending has status pending
update/updater.js Updater version
  ✅ should return rejected Promise when _pending is pending
  ✅ should return the result of npm.list

✅ test/unittests/tools/utilization.js

tools/utilization.js statistics
  ✅ allocations
  ✅ allocations middle
  ✅ allocations overday
  ✅ flashes
  ✅ maintenances
tools/utilization.js utilization
  ✅ usage utilization