Skip to content

Commit

Permalink
chore: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
devcorpio committed Dec 22, 2023
1 parent df7423d commit 582edc1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class TransactionService {
if (__DEV__) {
this._logger.debug(`startTransaction(${tr.id}, ${tr.name}, ${tr.type})`)
}
this._config.dispatchEvent(TRANSACTION_START, [tr])
this._config.events.send(TRANSACTION_START, [tr])
}

return tr
Expand Down Expand Up @@ -258,7 +258,7 @@ class TransactionService {
`transaction(${tr.id}, ${name}, ${type}) was discarded! The page was hidden during the transaction!`
)
}
this._config.dispatchEvent(TRANSACTION_DISCARD)
this._config.events.send(TRANSACTION_DISCARD)
return
}

Expand All @@ -268,7 +268,7 @@ class TransactionService {
`transaction(${tr.id}, ${name}, ${type}) is ignored`
)
}
this._config.dispatchEvent(TRANSACTION_DISCARD)
this._config.events.send(TRANSACTION_DISCARD)
return
}

Expand Down Expand Up @@ -340,7 +340,7 @@ class TransactionService {
const configContext = this._config.get('context')
addTransactionContext(tr, configContext)

this._config.dispatchEvent(TRANSACTION_END, [tr])
this._config.events.send(TRANSACTION_END, [tr])
if (__DEV__) {
this._logger.debug(
`end transaction(${tr.id}, ${tr.name}, ${tr.type})`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe('PerformanceMonitoring', function () {

it('should initialize and notify the transaction has been added to the queue', async () => {
performanceMonitoring.init()
spyOn(configService, 'dispatchEvent')
spyOn(configService, 'dispatchEvent').and.callThrough()

const tr = performanceMonitoring._transactionService.startTransaction(
'transaction',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('TransactionService', function () {
spyOn(logger, 'debug')

config = new Config()
spyOn(config, 'dispatchEvent')
spyOn(config.events, 'send').and.callThrough()
transactionService = new TransactionService(logger, config)
})

Expand Down Expand Up @@ -734,7 +734,7 @@ describe('TransactionService', function () {
expect(logger.debug).toHaveBeenCalledWith(
`transaction(${tr.id}, ${tr.name}, ${tr.type}) was discarded! The page was hidden during the transaction!`
)
expect(config.dispatchEvent).toHaveBeenCalledWith(TRANSACTION_DISCARD)
expect(config.events.send).toHaveBeenCalledWith(TRANSACTION_DISCARD)

state.lastHiddenStart = performance.now() - 1000
tr = transactionService.startTransaction('test-name', 'test-type')
Expand All @@ -751,7 +751,7 @@ describe('TransactionService', function () {
expect(logger.debug).toHaveBeenCalledWith(
`transaction(${tr.id}, ${tr.name}, ${tr.type}) is ignored`
)
expect(config.dispatchEvent).toHaveBeenCalledWith(TRANSACTION_DISCARD)
expect(config.events.send).toHaveBeenCalledWith(TRANSACTION_DISCARD)
})

it('should discard transaction configured to be ignored', async () => {
Expand All @@ -764,7 +764,7 @@ describe('TransactionService', function () {
expect(logger.debug).toHaveBeenCalledWith(
`transaction(${tr.id}, ${tr.name}, ${tr.type}) is ignored`
)
expect(config.dispatchEvent).toHaveBeenCalledWith(TRANSACTION_DISCARD)
expect(config.events.send).toHaveBeenCalledWith(TRANSACTION_DISCARD)
})

it('should set session information on transaction', () => {
Expand Down

0 comments on commit 582edc1

Please sign in to comment.