Skip to content

Commit

Permalink
refactor(session): Rename trackError -> _track and remove from public…
Browse files Browse the repository at this point in the history
… types
  • Loading branch information
bengourley committed Dec 17, 2019
1 parent cfe31a9 commit b76b550
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/core/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class BugsnagClient {
event.breadcrumbs = this.breadcrumbs.slice(0)

if (this._session) {
this._session.trackError(event)
this._session._track(event)
event.session = this._session
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Session {
}
}

trackError (event) {
_track (event) {
this[event._handledState.unhandled ? '_unhandled' : '_handled'] += 1
}
}
Expand Down
12 changes: 6 additions & 6 deletions packages/core/test/session.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ describe('@bugsnag/core/session', () => {
expect(s.events).toEqual({ handled: 0, unhandled: 0 })
})
})
describe('trackError()', () => {
describe('track()', () => {
it('returns the correct data structure', () => {
const s = new Session()
s.trackError({ _handledState: { unhandled: true } })
s.trackError({ _handledState: { unhandled: false } })
s.trackError({ _handledState: { unhandled: true } })
s.trackError({ _handledState: { unhandled: true } })
s.trackError({ _handledState: { unhandled: false } })
s._track({ _handledState: { unhandled: true } })
s._track({ _handledState: { unhandled: false } })
s._track({ _handledState: { unhandled: true } })
s._track({ _handledState: { unhandled: true } })
s._track({ _handledState: { unhandled: false } })
expect(s.toJSON().events).toEqual({ handled: 2, unhandled: 3 })
})
})
Expand Down
1 change: 0 additions & 1 deletion packages/core/types/session.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ declare class Session {
_handled: number;
_unhandled: number;
};
public trackError: (event: Event) => void;
}

export default Session;

0 comments on commit b76b550

Please sign in to comment.