Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hardillb committed Dec 13, 2024
1 parent 57f9561 commit 1e3592d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class Agent {
agentVersion: this.config.version,
licensed: this.config.licensed
}
if (this.launcher) {
if (this.launcher?.readPackage) {
const { modules } = await this.launcher.readPackage()
if (module['node-red'] !== 'latest') {
state.nodeRedVersion = modules['node-red']
Expand Down
20 changes: 10 additions & 10 deletions test/unit/lib/agent_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ describe('Agent', function () {
describe('getState', function () {
it('returns partial state', async function () {
const agent = createHTTPAgent()
const state = agent.getState()
const state = await agent.getState()
state.should.have.property('ownerType', 'none')
state.should.have.property('snapshot', null)
state.should.have.property('settings', null)
Expand All @@ -506,7 +506,7 @@ describe('Agent', function () {
it('returns partial state with developer mode', async function () {
const agent = createHTTPAgent()
agent.currentMode = 'developer'
const state = agent.getState()
const state = await agent.getState()
state.should.have.property('ownerType', 'none')
state.should.have.property('project', null)
state.should.have.property('snapshot', null)
Expand All @@ -525,7 +525,7 @@ describe('Agent', function () {
agent.currentSettings = { hash: 'settingsId' }
agent.config = { licensed: true }
agent.launcher = { state: 'running' }
const state = agent.getState()
const state = await agent.getState()
state.should.have.property('ownerType', 'project')
state.should.have.property('project', 'projectId')
state.should.have.property('snapshot', 'snapshotId')
Expand All @@ -543,7 +543,7 @@ describe('Agent', function () {
agent.currentSettings = { hash: 'settingsId' }
agent.config = { licensed: true }
agent.launcher = { state: 'running' }
const state = agent.getState()
const state = await agent.getState()
state.should.have.property('ownerType', 'application')
state.should.have.property('application', 'applicationId')
state.should.have.property('snapshot', 'snapshotId')
Expand All @@ -562,7 +562,7 @@ describe('Agent', function () {
agent.currentSettings = { hash: 'settingsId' }
agent.currentMode = 'developer'
agent.launcher = { state: 'running' }
const state = agent.getState()
const state = await agent.getState()
state.should.have.property('project', 'projectId')
state.should.have.property('snapshot', 'snapshotId')
state.should.have.property('settings', 'settingsId')
Expand All @@ -581,7 +581,7 @@ describe('Agent', function () {
agent.currentSnapshot = { id: 'snapshotId' }
agent.currentSettings = { hash: 'settingsId' }
agent.currentMode = 'developer'
const state = agent.getState()
const state = await agent.getState()
state.should.have.property('project', 'projectId')
state.should.have.property('snapshot', 'snapshotId')
state.should.have.property('settings', 'settingsId')
Expand All @@ -598,7 +598,7 @@ describe('Agent', function () {
agent.currentSnapshot = { id: 'snapshotId' }
agent.currentSettings = { hash: 'settingsId' }
agent.launcher = { state: 'running' }
const state = agent.getState()
const state = await agent.getState()
;(state === null).should.be.true()
})
})
Expand Down Expand Up @@ -1273,7 +1273,7 @@ describe('Agent', function () {

const agent2 = createMQTTAgent() // load the project file
await agent2.loadProject()
const state = agent2.getState()
const state = await agent2.getState()
state.should.have.property('project', null)
state.should.have.property('snapshot', null)
state.should.have.property('settings', null)
Expand Down Expand Up @@ -1301,7 +1301,7 @@ describe('Agent', function () {
await agent2.start()

// fake a check-in what will start the launcher and the attempt to start the tunnel
const state = agent2.getState()
const state = await agent2.getState()
await agent2.setState(state)

// fail safe this test by checking the launcher was created and start was called
Expand Down Expand Up @@ -1339,7 +1339,7 @@ describe('Agent', function () {
await agent2.start()

// fake a check-in what will start the launcher
const state = agent2.getState()
const state = await agent2.getState()
await agent2.setState(state)

// fail safe this test by checking the launcher was created and start was called
Expand Down

0 comments on commit 1e3592d

Please sign in to comment.