@scm-manager/ui-tests 3.7.5 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- @scm-manager/ui-tests:depcheck: cache hit, replaying output 6b200a6d01e7ae26
1
+ @scm-manager/ui-tests:depcheck: cache hit, replaying output 7c3f0518f393422a
2
2
  @scm-manager/ui-tests:depcheck: $ depcheck
3
3
  @scm-manager/ui-tests:depcheck: No depcheck issue
@@ -1,2 +1,2 @@
1
- @scm-manager/ui-tests:typecheck: cache hit, replaying output 8ec73cf55279327d
1
+ @scm-manager/ui-tests:typecheck: cache hit, replaying output 0dabec53af9c6971
2
2
  @scm-manager/ui-tests:typecheck: $ tsc
package/enzyme-router.ts CHANGED
@@ -20,8 +20,9 @@ import { createMount, createShallow } from "enzyme-context";
20
20
  import { routerContext } from "enzyme-context-react-router-4";
21
21
 
22
22
  const plugins = {
23
- history: routerContext()
23
+ history: routerContext(),
24
24
  };
25
25
 
26
+ // TODO Enzyme is not going to be supported in React 19+.: https://testing-library.com/docs/react-testing-library/migrate-from-enzyme/
26
27
  export const mount = createMount(plugins);
27
28
  export const shallow = createShallow(plugins);
package/i18n.ts CHANGED
@@ -14,16 +14,32 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- export const jestMock = jest.mock("react-i18next", () => ({
18
- // this mock makes sure any components using the translate HoC receive the t function as a prop
19
- withTranslation: () => (Component: any) => {
20
- Component.defaultProps = {
21
- ...Component.defaultProps,
22
- t: (key: string) => key
23
- };
24
- return Component;
25
- },
26
- useTranslation: (ns: string) => {
27
- return [(key: string) => key];
28
- }
29
- }));
17
+ import { initReactI18next } from "react-i18next";
18
+ import i18n from "i18next";
19
+
20
+ /**
21
+ * This provides a minimum i18next scaffold during initialization of a unit test.
22
+ *
23
+ * It does not connect to the i18next information used in production,
24
+ * but avoids warnings emerging due to i18next being uninitialized.
25
+ *
26
+ * More information: <a href="https://react.i18next.com/misc/testing">https://react.i18next.com/misc/testing</a>
27
+ */
28
+ export function stubI18Next() {
29
+ // TODO should be changed to async/await
30
+ i18n.use(initReactI18next).init({
31
+ lng: "de",
32
+ fallbackLng: "en",
33
+
34
+ ns: ["translationsNS"],
35
+ defaultNS: "translationsNS",
36
+
37
+ debug: false,
38
+
39
+ interpolation: {
40
+ escapeValue: false,
41
+ },
42
+
43
+ resources: { en: { translationsNS: {} } },
44
+ });
45
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-manager/ui-tests",
3
- "version": "3.7.5",
3
+ "version": "3.8.0",
4
4
  "description": "UI-Tests helpers",
5
5
  "author": "Sebastian Sdorra <sebastian.sdorra@cloudogu.com>",
6
6
  "license": "AGPL-3.0-only",
@@ -14,7 +14,9 @@
14
14
  "enzyme": "^3.11.0",
15
15
  "enzyme-context": "^1.1.2",
16
16
  "enzyme-context-react-router-4": "^2.0.0",
17
- "raf": "^3.4.1"
17
+ "i18next": "21",
18
+ "raf": "^3.4.1",
19
+ "react-i18next": "11"
18
20
  },
19
21
  "peerDependencies": {
20
22
  "@scm-manager/tsconfig": "^2.13.0",