Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Updated intialization to properly return the api on start up to the security agent #1807

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function initApi({ agent, apiPath }) {

const api = new API(agent)
require.cache.__NR_cache = module.exports = api
return api
}

function initialize() {
Expand Down
3 changes: 2 additions & 1 deletion test/unit/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,9 @@ test('index tests', (t) => {

t.test('should load k2 agent if config.security.agent.enabled', (t) => {
mockConfig.security.agent.enabled = true
loadIndex()
const api = loadIndex()
t.equal(k2Stub.start.callCount, 1, 'should register security agent')
t.same(k2Stub.start.args[0][0], api, 'should call start on security agent with proper args')
t.end()
})

Expand Down