Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove snapshots testing assertions #530

Merged
merged 4 commits into from
May 31, 2022
Merged

Conversation

cescoferraro
Copy link
Contributor

This PR removes all snapshot testing assertions and fixes most of the tests

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

Copy link
Collaborator

@xoscar xoscar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @cescoferraro GJ! I left some comments and concerns. Let me know what you think

cursor: pointer;

${({isCollapsed}) =>
isCollapsed
${({$isCollapsed}) =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the idea around the $? is this causing any warnings or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it causes warning on the console & on testing

@@ -29,6 +29,7 @@ const Diagram: React.FC<IDiagramProps> = ({trace, selectedSpan, onSelectSpan}):
);
}, [trace?.spans]);

console.log(spanMap);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😬

@@ -1,5 +1,5 @@
import {capitalize} from 'lodash';
import {useCallback} from 'react';
import React, {useCallback} from 'react';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should need to explicitly import React anymore

@@ -9,8 +9,11 @@ import TestCardActions from './TestCardActions';

interface TTestCardProps {
test: TTest;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see what prettier rules are you using, mine doesn't add the extra whitespace

import {TTest} from '../../../types/Test.types';
import {HTTP_METHOD} from '../../../constants/Common.constants';

const spanId = '4938u43';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the mock factories, you can overwrite the different values if you want

@@ -13,6 +13,7 @@ const TraceMock: IMockFactory<TTrace, TRawTrace> = () => ({
'1': SpanMock.raw(),
'2': SpanMock.raw(),
},
spans: [SpanMock.raw(), SpanMock.raw()],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The raw trace doesn't have a spans array, it either comes from the flat or the tree section.

({key, operator = CompareOperator.EQUALS, value}) =>
`${key}${OperatorService.getOperatorSymbol(operator)}${getValue(value)}`
);
selectors.map(({key, operator = CompareOperator.EQUALS, value}) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm changing some of this on my next PR as I'm working on moving the assertions to the backend

@@ -46,7 +49,7 @@ const getPseudoSelectorString = (pseudoSelector?: TPseudoSelector): string => {
const SelectorService = () => ({
getSelectorString(selectorList: TSpanSelector[], pseudoSelector?: TPseudoSelector): string {
return selectorList.length
? `span[${getFilters(selectorList).join(' ')}]${getPseudoSelectorString(pseudoSelector)}`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the double space to make this work, as we are doing a double space split on line 61

selectors.map(({key, operator, value}) => `${key} ${operator} ${getValue(value)}`);
const getFilters = (selectors: TSpanSelector[]) => {
return selectors.map(
({key, operator, value}) => `${key}${operator === 'contains' ? ` ${operator} ` : operator}${getValue(value)}`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can always have the spaces between for the operator so I'm not sure that we need to check for contains directly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's roll back the changes made around the selectors and we should be good to merge!

@cescoferraro cescoferraro requested a review from xoscar May 25, 2022 15:49
@cescoferraro cescoferraro force-pushed the feat/remove_snapshots branch 3 times, most recently from 9922fb0 to b0c35d6 Compare May 31, 2022 16:46
@cescoferraro cescoferraro merged commit a057a7a into main May 31, 2022
@mathnogueira mathnogueira deleted the feat/remove_snapshots branch June 25, 2022 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants