From 7684c90fba2407d5a6bde28c0339b5be3b521185 Mon Sep 17 00:00:00 2001 From: Rodrigo Pedroso Date: Mon, 2 Sep 2019 23:00:44 -0400 Subject: [PATCH] Updated readme. Cleaned up unused file. --- README.md | 24 +++++++++++++++++------- src/views/utils.js | 21 --------------------- 2 files changed, 17 insertions(+), 28 deletions(-) delete mode 100644 src/views/utils.js diff --git a/README.md b/README.md index 93431aa..e748329 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ The end points of Tempo's REST API provide segmented info of their teams and mem 2. A Team view with all members of a selected team 3. A Member view with the info of a selected member -This structure allows some segmentation of the API calls. For example, the call for a member's inf can be made only when the third view is loaded. But there is still a lot of information still must me loaded in the Home view and passed forward to other views. +This structure allows segmentation of the API calls. For example, the call for a member's data is made only when the third view is loaded. Yet, many calls are done right when loading the first Home view, and the data retrieved there must be passed down to the other components. -As the app is small, I chose not to implement Redux, Redux-Saga nor similar solutions. Instead, I used react-router v4 with a structure to manage the transfer of props between components. +To do so, I chose not to implement Redux, Redux-Saga nor similar solutions. Instead, I used react-router v4 with a structure to manage the transfer of props between components. This choice favors simplicity and fits quite well for small applications, specially when using React Hooks, as is the case. @@ -46,12 +46,17 @@ The all-mighty router is in `src/components`. │   │   ├── Router.jsx │   │   └── TeamList.jsx │   ├── views +│   │   ├── __mocks__ +│   │   │   └── axios.js │   │   ├── Home.jsx │   │   ├── Home.scss +│   │   ├── Home.test.js │   │   ├── Member.jsx │   │   ├── Member.scss +│   │   ├── Member.test.js │   │   ├── Team.jsx -│   │   └── Team.scss +│   │   ├── Team.scss +│   │   └── Team.test.js │   ├── App.js │   ├── App.scss │   ├── App.test.js @@ -59,14 +64,13 @@ The all-mighty router is in `src/components`. │   ├── history.js │   ├── index.css │   ├── index.js -│   └── serviceWorker.js +│   ├── serviceWorker.js +│   └── setupTests.js ├── LICENSE ├── README.md ├── package-lock.json ├── package.json -└── yarn.lock - -4 directories, 26 files +└── pbcopy ``` ## Requirements @@ -88,3 +92,9 @@ Start the app npm start Open a browser and access `http://localhost:3000`. + +## Tests + +Test written with Jest and React Testing Library. To run tests: + + yarn test diff --git a/src/views/utils.js b/src/views/utils.js deleted file mode 100644 index d870d29..0000000 --- a/src/views/utils.js +++ /dev/null @@ -1,21 +0,0 @@ -import { act as reactAct } from 'react-dom/test-utils'; - -const SUPPRESSED_PREFIXES = [ - "Warning: Do not await the result of calling ReactTestUtils.act(...)", - "Warning: An update to %s inside a test was not wrapped in act(...)", -]; - -function isSuppressedErrorMessage(message: string): boolean { - return SUPPRESSED_PREFIXES.some(sp => message.startsWith(sp)); -} - -export async function act(f: () => void): Promise { - const oldError = window.console.error; - window.console.error = (...args: any[]) => { - if (!isSuppressedErrorMessage(args[0])) { - oldError(...args); - } - }; - await Promise.race([reactAct(f), new Promise(res => setTimeout(res))]); - window.console.error = oldError; -}