Skip to content

Commit

Permalink
use jest-specific functions instead of reaching into mock calls for e…
Browse files Browse the repository at this point in the history
…xepcted values
  • Loading branch information
dhurley14 committed Aug 9, 2021
1 parent 8dd966f commit ba1857e
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ describe('bulkUpdate()', () => {
status: 'closed',
})
).rejects.toThrowErrorMatchingInlineSnapshot(`"Unauthorized for fake.rule and apm"`);
expect(auditLogger.log.mock.calls).toHaveLength(2);
expect(auditLogger.log.mock.calls[0][0]).toEqual({
expect(auditLogger.log).toHaveBeenCalledTimes(2);
expect(auditLogger.log).toHaveBeenNthCalledWith(1, {
message: `Failed attempt to update alert [id=${unsuccessfulAuthzHit}]`,
event: {
action: 'alert_update',
Expand All @@ -223,7 +223,7 @@ describe('bulkUpdate()', () => {
message: 'Unauthorized for fake.rule and apm',
},
});
expect(auditLogger.log.mock.calls[1][0]).toEqual({
expect(auditLogger.log).toHaveBeenNthCalledWith(2, {
message: `Failed attempt to update alert [id=${successfulAuthzHit}]`,
event: {
action: 'alert_update',
Expand Down Expand Up @@ -422,8 +422,8 @@ describe('bulkUpdate()', () => {
Error: Error: Unauthorized for fake.rule and apm"
`);

expect(auditLogger.log.mock.calls).toHaveLength(2);
expect(auditLogger.log.mock.calls[0][0]).toEqual({
expect(auditLogger.log).toHaveBeenCalledTimes(2);
expect(auditLogger.log).toHaveBeenNthCalledWith(1, {
message: `Failed attempt to update alert [id=${unsuccessfulAuthzHit}]`,
event: {
action: 'alert_update',
Expand All @@ -436,7 +436,7 @@ describe('bulkUpdate()', () => {
message: 'Unauthorized for fake.rule and apm',
},
});
expect(auditLogger.log.mock.calls[1][0]).toEqual({
expect(auditLogger.log).toHaveBeenNthCalledWith(2, {
message: `Failed attempt to update alert [id=${successfulAuthzHit}]`,
event: {
action: 'alert_update',
Expand Down

0 comments on commit ba1857e

Please sign in to comment.