Skip to content

Commit

Permalink
Use nanoid from Redux Toolkit.
Browse files Browse the repository at this point in the history
  • Loading branch information
huwshimi committed Apr 8, 2020
1 parent 2aa9765 commit f173654
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"date-fns": "2.11.1",
"formik": "2.1.4",
"http-proxy-middleware": "1.0.3",
"nanoid": "3.0.2",
"path-parse": "1.0.6",
"pluralize": "8.0.0",
"prop-types": "15.7.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button } from "@canonical/react-components";
import classNames from "classnames";
import { nanoid } from "nanoid";
import { nanoid } from "@reduxjs/toolkit";
import PropTypes from "prop-types";
import React, { useEffect, useRef } from "react";
import usePortal from "react-useportal";
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/base/components/FormikField/FormikField.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Input } from "@canonical/react-components";
import { useField } from "formik";
import PropTypes from "prop-types";
import React, { useRef } from "react";
import { nanoid } from "nanoid";
import { nanoid } from "@reduxjs/toolkit";

const FormikField = ({
component: Component = Input,
Expand Down
10 changes: 7 additions & 3 deletions ui/src/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import Adapter from "enzyme-adapter-react-16";

Enzyme.configure({ adapter: new Adapter() });

jest.mock("nanoid", () => ({
nanoid: jest.fn(() => "Uakgb_J5m9g-0JDMbcJqLJ"),
}));
jest.mock("@reduxjs/toolkit", () => {
const toolkit = require.requireActual("@reduxjs/toolkit");
return {
...toolkit,
nanoid: jest.fn(() => "Uakgb_J5m9g-0JDMbcJqLJ"),
};
});
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10551,11 +10551,6 @@ nan@^2.12.1, nan@^2.13.2:
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c"
integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==

[email protected]:
version "3.0.2"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.0.2.tgz#37e91e6f5277ce22335be473e2a5db1bd96dd026"
integrity sha512-WOjyy/xu3199NlQiQWlx7VbspSFlGtOxa1bRX9ebmXOnp1fje4bJfjPs1wLQ8jZbJUfD+yceJmw879ZSaVJkdQ==

nanomatch@^1.2.9:
version "1.2.13"
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119"
Expand Down

0 comments on commit f173654

Please sign in to comment.