Skip to content

Commit

Permalink
Merge pull request #603 from DataDog/louiszawadzki/rum-2345/fix-asser…
Browse files Browse the repository at this point in the history
…tions

Fix internal testing assertions for android
  • Loading branch information
louiszawadzki authored Feb 2, 2024
2 parents 16a7145 + 45b99e9 commit 475c1f6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions packages/internal-testing-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
},
"devDependencies": {
"@testing-library/react-native": "7.0.2",
"react-native-builder-bob": "0.17.1"
"react-native-builder-bob": "0.17.1",
"rum-events-format": "DataDog/rum-events-format#workspace=rum-events-format"
},
"jest": {
"preset": "react-native",
Expand Down Expand Up @@ -90,8 +91,5 @@
"android": {
"javaPackageName": "com.datadog.reactnative.internaltesting"
}
},
"dependencies": {
"rum-events-format": "DataDog/rum-events-format#workspace=rum-events-format"
}
}
2 changes: 1 addition & 1 deletion packages/internal-testing-tools/src/InternalTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class InternalTestingWrapper {
);
}

return JSON.parse(events);
return JSON.parse(events).map((event: string) => JSON.parse(event));
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export const mockRumLongTask = ({
duration: duration || 0
},
context: {
long_task: {
target: thread
}
'long_task.target': thread
},
date: 0,
application: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const buildRumLongTaskAssertions = (events: RumLongTaskEvent[]) => {
// Disabling ts as trying to safely access attributes won't crash the app
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
longTask.context?.['long_task']?.['target'] !==
longTask.context?.['long_task.target'] !==
'javascript'
) {
return false;
Expand All @@ -35,7 +35,7 @@ export const buildRumLongTaskAssertions = (events: RumLongTaskEvent[]) => {
// Disabling ts as trying to safely access attributes won't crash the app
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
longTask.context?.['long_task']?.['target'] ===
longTask.context?.['long_task.target'] ===
'javascript'
) {
return false;
Expand Down

0 comments on commit 475c1f6

Please sign in to comment.