1+ import { describe , it , expect , vi , beforeEach } from 'vitest'
12import type { RumInitConfiguration , RumPublicApi } from '@datadog/browser-rum-core'
23import { registerCleanupTask } from '../../../core/test'
34import { angularPlugin , onRumInit , onRumStart , resetAngularPlugin } from './angularPlugin'
@@ -15,16 +16,16 @@ describe('angularPlugin', () => {
1516 it ( 'returns a plugin object' , ( ) => {
1617 const plugin = angularPlugin ( )
1718 expect ( plugin ) . toEqual (
18- jasmine . objectContaining ( {
19+ expect . objectContaining ( {
1920 name : 'angular' ,
20- onInit : jasmine . any ( Function ) ,
21- onRumStart : jasmine . any ( Function ) ,
21+ onInit : expect . any ( Function ) ,
22+ onRumStart : expect . any ( Function ) ,
2223 } )
2324 )
2425 } )
2526
2627 it ( 'calls callbacks registered with onRumInit during onInit' , ( ) => {
27- const callbackSpy = jasmine . createSpy ( )
28+ const callbackSpy = vi . fn ( )
2829 const pluginConfiguration = { }
2930 onRumInit ( callbackSpy )
3031
@@ -36,12 +37,12 @@ describe('angularPlugin', () => {
3637 } )
3738
3839 expect ( callbackSpy ) . toHaveBeenCalledTimes ( 1 )
39- expect ( callbackSpy . calls . mostRecent ( ) . args [ 0 ] ) . toBe ( pluginConfiguration )
40- expect ( callbackSpy . calls . mostRecent ( ) . args [ 1 ] ) . toBe ( PUBLIC_API )
40+ expect ( callbackSpy . mock . lastCall ! [ 0 ] ) . toBe ( pluginConfiguration )
41+ expect ( callbackSpy . mock . lastCall ! [ 1 ] ) . toBe ( PUBLIC_API )
4142 } )
4243
4344 it ( 'calls callbacks immediately if onInit was already invoked' , ( ) => {
44- const callbackSpy = jasmine . createSpy ( )
45+ const callbackSpy = vi . fn ( )
4546 const pluginConfiguration = { }
4647 angularPlugin ( pluginConfiguration ) . onInit ! ( {
4748 publicApi : PUBLIC_API ,
@@ -51,8 +52,8 @@ describe('angularPlugin', () => {
5152 onRumInit ( callbackSpy )
5253
5354 expect ( callbackSpy ) . toHaveBeenCalledTimes ( 1 )
54- expect ( callbackSpy . calls . mostRecent ( ) . args [ 0 ] ) . toBe ( pluginConfiguration )
55- expect ( callbackSpy . calls . mostRecent ( ) . args [ 1 ] ) . toBe ( PUBLIC_API )
55+ expect ( callbackSpy . mock . lastCall ! [ 0 ] ) . toBe ( pluginConfiguration )
56+ expect ( callbackSpy . mock . lastCall ! [ 1 ] ) . toBe ( PUBLIC_API )
5657 } )
5758
5859 it ( 'enforce manual view tracking when router is enabled' , ( ) => {
@@ -77,8 +78,8 @@ describe('angularPlugin', () => {
7778 } )
7879
7980 it ( 'calls onRumStart subscribers during onRumStart' , ( ) => {
80- const callbackSpy = jasmine . createSpy ( )
81- const addErrorSpy = jasmine . createSpy ( )
81+ const callbackSpy = vi . fn ( )
82+ const addErrorSpy = vi . fn ( )
8283 onRumStart ( callbackSpy )
8384
8485 angularPlugin ( ) . onRumStart ! ( { addError : addErrorSpy } )
@@ -87,10 +88,10 @@ describe('angularPlugin', () => {
8788 } )
8889
8990 it ( 'calls onRumStart subscribers immediately if already started' , ( ) => {
90- const addErrorSpy = jasmine . createSpy ( )
91+ const addErrorSpy = vi . fn ( )
9192 angularPlugin ( ) . onRumStart ! ( { addError : addErrorSpy } )
9293
93- const callbackSpy = jasmine . createSpy ( )
94+ const callbackSpy = vi . fn ( )
9495 onRumStart ( callbackSpy )
9596
9697 expect ( callbackSpy ) . toHaveBeenCalledWith ( addErrorSpy )
0 commit comments