From 1c5117f6d40c5951929ca2a9d56e538cc99cd71c Mon Sep 17 00:00:00 2001 From: Alejandro Lembke Barrientos Date: Mon, 23 May 2022 15:32:14 +0000 Subject: [PATCH] Passing Test, routes and config to ts and tsx format. --- config/{index.js => index.ts} | 2 +- package.json | 2 +- .../components/__tests__/{App.test.js => App.test.tsx} | 6 +++--- src/frontend/index.tsx | 2 +- src/frontend/setStore.ts | 2 +- src/routes/{index.js => index.tsx} | 0 src/server/server.js | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename config/{index.js => index.ts} (77%) rename src/frontend/components/__tests__/{App.test.js => App.test.tsx} (76%) rename src/routes/{index.js => index.tsx} (100%) diff --git a/config/index.js b/config/index.ts similarity index 77% rename from config/index.js rename to config/index.ts index bea1723..7c8ba6f 100644 --- a/config/index.js +++ b/config/index.ts @@ -3,4 +3,4 @@ const config = { port: process.env.PORT ? process.env.PORT : 80, }; -module.exports = { config: config }; +export default config; diff --git a/package.json b/package.json index f6b2122..780fcca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aleleba/create-react-ssr", - "version": "2.0.2", + "version": "2.0.3", "description": "Starter Kit of server side render of react", "bin": "./bin/cli.js", "main": "src/server/index", diff --git a/src/frontend/components/__tests__/App.test.js b/src/frontend/components/__tests__/App.test.tsx similarity index 76% rename from src/frontend/components/__tests__/App.test.js rename to src/frontend/components/__tests__/App.test.tsx index 6021492..25a0680 100644 --- a/src/frontend/components/__tests__/App.test.js +++ b/src/frontend/components/__tests__/App.test.tsx @@ -5,17 +5,17 @@ import App from '../App'; describe(' Component', () => { beforeEach(() => { - fetch.resetMocks(); + fetchMock.resetMocks(); }); test('Should render root Component', async () => { - fetch.mockResponseOnce(JSON.stringify({ + fetchMock.mockResponseOnce(JSON.stringify({ //First Data Fetch data: 'data' })); render( - + ) diff --git a/src/frontend/index.tsx b/src/frontend/index.tsx index 8bd84ef..2894dd3 100644 --- a/src/frontend/index.tsx +++ b/src/frontend/index.tsx @@ -6,7 +6,7 @@ import { BrowserRouter as Router } from 'react-router-dom'; import { Provider } from 'react-redux'; import { IInitialState } from './reducers/index'; import setStore from './setStore'; -import { config } from '../../config'; +import config from '../../config'; import './styles/global.sass'; import App from './components/App'; diff --git a/src/frontend/setStore.ts b/src/frontend/setStore.ts index cc29cda..bc7fcc6 100644 --- a/src/frontend/setStore.ts +++ b/src/frontend/setStore.ts @@ -2,7 +2,7 @@ import { createStore } from 'redux'; //, applyMiddleware // import { Provider } from 'react-redux'; import { composeWithDevTools as composeWithDevToolsWeb } from 'redux-devtools-extension'; -import { config } from '../../config'; +import config from '../../config'; import reducer, { IInitialState } from './reducers'; diff --git a/src/routes/index.js b/src/routes/index.tsx similarity index 100% rename from src/routes/index.js rename to src/routes/index.tsx diff --git a/src/server/server.js b/src/server/server.js index f8c8852..0d97c63 100644 --- a/src/server/server.js +++ b/src/server/server.js @@ -1,6 +1,6 @@ //Dependencies of Server import express from 'express'; -import { config } from '../../config'; +import config from '../../config'; import webpack from 'webpack'; import helmet from 'helmet';