Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timofei-iatsenko committed Jun 19, 2024
1 parent 9d8224f commit 2149ce4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
7 changes: 6 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ module.exports = {
verbose: true,
roots: ["<rootDir>/transforms", "<rootDir>/bin"],
transform: {
"^.+\\.ts?$": "ts-jest",
"^.+\\.ts?$": [
"ts-jest",
{
tsconfig: "./tsconfig.spec.json",
},
],
},
};
6 changes: 3 additions & 3 deletions transforms/__testfixtures__/v2-to-v3/complete.output.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { plural, Trans } from "@lingui/macro";

const App = () => {
return (
<div>
(<div>
<div>
{i18n.number(1_000_000, { currency: "EUR" })}
</div>
Expand All @@ -26,8 +26,8 @@ const App = () => {
})}
{select({ value, one: "# book", other: "# books" })}
{selectOrdinal({ value, one: "# book", other: "# books" })}
</div>
</div>)
);
}

export default withI18n()(App)
export default withI18n()(App)
4 changes: 2 additions & 2 deletions transforms/__testfixtures__/v2-to-v3/i18nProvider.input.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";
import { I18nProvider } from "@lingui/react"
import { I18nProvider } from "@lingui/react"

export const App = () => {
return (
<I18nProvider defaultRender="p">
<div>hola</div>
</I18nProvider>
);
}
}
8 changes: 4 additions & 4 deletions transforms/__testfixtures__/v2-to-v3/i18nProvider.output.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";
import { I18nProvider } from "@lingui/react"
import { I18nProvider } from "@lingui/react"

export const App = () => {
return (
<I18nProvider defaultComponent="p">
(<I18nProvider defaultComponent="p">
<div>hola</div>
</I18nProvider>
</I18nProvider>)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const GLOBAL_VALUE = new Date();
const App = () => {
const count = 1;
return (
<div>
(<div>
{i18n.date(new Date(), { hour12: true })}
{i18n.date(new Date())}
{i18n.date(GLOBAL_VALUE)}
Expand Down Expand Up @@ -48,7 +48,7 @@ const App = () => {
female="Her book"
other="Their book"
/>
</div>
</div>)
);
}

Expand All @@ -62,4 +62,4 @@ const formatAssetValue = (value) => {
return formatValue;
}
return "-";
};
};
2 changes: 2 additions & 0 deletions transforms/v2-to-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ function changeJsxToCoreDeprecatedFuncs(root: Collection, j: JSCodeshift) {

// if is a direct return, just add parenthesis
if (path.parentPath.value.type === "ReturnStatement") {
// return ast;

return j.parenthesizedExpression(ast);
}

Expand Down

0 comments on commit 2149ce4

Please sign in to comment.