Skip to content
Snippets Groups Projects
Commit 05de3737 authored by ParkJooHyun's avatar ParkJooHyun
Browse files

update host name test

parent 2ccc59b3
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,8 @@ const { get } = require("request");
const host = 'http://localhost:3001'
const destrib_host = 'http://terajoo.tk:3001'
const getHost = (n) => {
const bgetHost = () => {
return host;
}
module.exports = getHost;
\ No newline at end of file
module.exports = bgetHost;
\ No newline at end of file
......@@ -8,9 +8,10 @@ const bodyParser = require('body-parser');
const session = require('express-session');
const FileStore = require('session-file-store')(session);
const getHost = require('./lib/host');
var bgetHost = require('./lib/host');
app.use(cors({
origin: 'http://localhost:3000',
origin: bgetHost(),
credentials: true
}));
app.set('view engine', 'ejs')
......
module.exports = {
"presets": ["@babel/preset-env"]
}
\ No newline at end of file
module.exports = {
moduleFileExtensions: ["js", "json", "jsx", "ts", "tsx", "json"],
transform: {
'^.+\\.(js|jsx)?$': 'babel-jest'
},
testEnvironment: 'node',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1'
},
testMatch: [
'<rootDir>/**/*.test.(js|jsx|ts|tsx)', '<rootDir>/(tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx))'
],
transformIgnorePatterns: ['<rootDir>/node_modules/']
};
\ No newline at end of file
This diff is collapsed.
......@@ -3,15 +3,12 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.1",
"@testing-library/user-event": "^12.2.0",
"axios": "^0.21.0",
"bootstrap": "^4.5.3",
"bootstrap-icons": "^1.1.0",
"cors": "^2.8.5",
"cross-env": "^7.0.2",
"enzyme": "^3.11.0",
"enzyme-to-json": "^3.6.1",
"http-proxy-middleware": "^1.0.6",
"mysql": "^2.18.1",
......@@ -30,7 +27,7 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"test": "jest",
"eject": "react-scripts eject"
},
"eslintConfig": {
......@@ -58,5 +55,16 @@
"snapshotSerializers": [
"enzyme-to-json/serializer"
]
},
"devDependencies": {
"@babel/plugin-syntax-jsx": "^7.12.1",
"@babel/preset-react": "^7.12.10",
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"babel-core": "^6.26.3",
"babel-jest": "^26.6.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"jest": "^26.6.3"
}
}
import { render, screen } from '@testing-library/react';
import App from './shared/App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
import React from 'react';
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import {getHost} from './lib/host' // frontend host 함수
var bgetHost = require('../../back_end/lib/host'); // backend host 함수
configure({ adapter: new Adapter() });
describe('host test', () => {
it(`backend 의 host와 frontend 의 호스트가 동일해야 합니다.
Front Host : ${getHost()}
Back Host : ${bgetHost()}`, () => {
expect(getHost()).toBe(bgetHost());
});
});
\ No newline at end of file
import React from 'react';
import { mount } from 'enzyme';
import Home from '../pages/Home';
describe('<Home />', () => {
it('matches snapshot', () => {
const wrapper = mount(<Home/>);
expect(wrapper).toMatchSnapshot();
});
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment