Skip to content

Commit

Permalink
additional test to ensure settings.js loads the auditLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve-Mcl committed Feb 6, 2024
1 parent a412bee commit a5da06b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/unit/lib/launcher_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,21 @@ describe('Launcher', function () {
settings.flowforge.auditLogger.should.have.property('token', configWithPlatformInfo.token)
settings.flowforge.auditLogger.should.have.property('bin', path.join(__dirname, '..', '..', '..', 'lib', 'auditLogger', 'index.js'))
})
it('settings.js loads audit logger with settings from config', async function () {
const launcher = newLauncher(configWithPlatformInfo, null, 'projectId', setup.snapshot)
const expectedURL = `${configWithPlatformInfo.forgeURL}/logging/device/${configWithPlatformInfo.deviceId}/audit`
await launcher.writeSettings()

// copy the template-settings as settings.js to the test dir
await fs.copyFile(path.join(__dirname, '..', '..', '..', 'lib', 'template', 'template-settings.js'), path.join(config.dir, 'project', 'settings.js'))
const runtimeSettings = require(path.join(config.dir, 'project', 'settings.js'))
should(runtimeSettings).be.an.Object()
runtimeSettings.should.have.property('logging').and.be.an.Object()
runtimeSettings.logging.should.have.property('auditLogger').and.be.an.Object()
runtimeSettings.logging.auditLogger.should.have.property('level', 'off')
runtimeSettings.logging.auditLogger.should.have.property('audit', true)
runtimeSettings.logging.auditLogger.should.have.property('handler').and.be.a.Function()
runtimeSettings.logging.auditLogger.should.have.property('loggingURL', expectedURL)
runtimeSettings.logging.auditLogger.should.have.property('token', configWithPlatformInfo.token)
})
})

0 comments on commit a5da06b

Please sign in to comment.