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 unit test that was comparing new/old reduce-css-calc #3868

Merged
merged 1 commit into from Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 0 additions & 47 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -146,7 +146,6 @@
"react-dom": "^16.14.0",
"react-router-dom": "^5.1.2",
"reassure": "^0.9.1",
"reduce-css-calc": "^2.1.8",
"rimraf": "^3.0.2",
"storybook": "^7.4.6",
"storybook-addon-performance": "^0.17.1",
Expand Down
15 changes: 2 additions & 13 deletions test/util/ReduceCssCalcPrototype.spec.ts
@@ -1,5 +1,3 @@
import oldReduceCSSCalc from 'reduce-css-calc';
import { log } from 'console';
import { reduceCSSCalc, safeEvaluateExpression } from '../../src/util/ReduceCSSCalc';

describe('number calculate', () => {
Expand Down Expand Up @@ -84,7 +82,7 @@ const cssLengthPair = cssLengthUnits.reduce<string[][]>((result, unit1, index1)
return result;
}, []);

describe('reduce-css-calc', () => {
describe('reduceCSSCalc', () => {
cssLengthPair.forEach(([unit1, unit2]) => {
[
{ capHeight: `123${unit1}`, lineHeight: `456${unit2}`, wordsByLines: 3 },
Expand All @@ -101,16 +99,7 @@ describe('reduce-css-calc', () => {
`calc(${capHeight} * -${lineHeight})`,
`calc(${capHeight} / -${lineHeight})`,
].forEach(calcString => {
try {
const newCalc = reduceCSSCalc(calcString);
const prevCalc = oldReduceCSSCalc(calcString);

if (!(prevCalc.includes('calc') || prevCalc.includes(' '))) {
expect(prevCalc).toEqual(newCalc);
}
} catch (e) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Test failures from expect are reported as an exception - so this catch turns this test into an always green one. Don't catch exceptions in tests.

Copy link
Member

Choose a reason for hiding this comment

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

Some of the tests were added to explicitly show that the old reduce css calc threw errors in those cases, but agreed should be maybe been a separate block with expect to throw

log('prevCalc throw error');
}
expect(() => reduceCSSCalc(calcString)).not.toThrow();
});
});
});
Expand Down
1 change: 0 additions & 1 deletion types.d.ts
@@ -1,3 +1,2 @@
declare module 'recharts-scale';
declare module 'react-smooth';
declare module 'reduce-css-calc';