This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM node:12 | |
| WORKDIR /app | |
| COPY ./package*.json ./ | |
| RUN npm install | |
| ENV PORT=4000 | |
| COPY . . | |
| CMD ["npm","run","start"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { unmountComponentAtNode } from "react-dom"; | |
| let container = null; | |
| beforeEach(() => { | |
| // 렌더링 컨테이너로 활용하기 위한 DOM element 를 생성합니다 | |
| container = document.createElement("div"); | |
| document.body.appendChild(container); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from "react"; | |
| export default function Counter() { | |
| const [count, setCount] = useState(0); | |
| return ( | |
| <div> | |
| <h1>Counter: {count}</h1> | |
| <button data-testid="dec" onClick={() => setCount((count) => count - 1)}> | |
| - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Counter.test.js | |
| import ReactDOM, { unmountComponentAtNode } from "react-dom"; | |
| import { act } from "react-dom/test-utils"; | |
| import Counter from "./Counter"; | |
| let container = null; | |
| beforeEach(() => { | |
| // 렌더링 컨테이너로 활용하기 위한 DOM element 를 생성합니다 | |
| container = document.createElement("div"); | |
| document.body.appendChild(container); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Counter.test.js | |
| import { getQueriesForElement } from "@testing-library/dom"; | |
| import ReactDOM, { unmountComponentAtNode } from "react-dom"; | |
| import { act } from "react-dom/test-utils"; | |
| import Counter from "./Counter"; | |
| let container = null; | |
| beforeEach(() => { | |
| container = document.createElement("div"); | |
| document.body.appendChild(container); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Counter.test.js | |
| import { getQueriesForElement } from "@testing-library/dom"; | |
| import ReactDOM, { unmountComponentAtNode } from "react-dom"; | |
| import { act } from "react-dom/test-utils"; | |
| import Counter from "./Counter"; | |
| let container = null; | |
| export const render = (element) => { | |
| container = document.createElement("div"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import { render } from "@testing-library/react"; | |
| import Counter from "./Counter"; | |
| it("Counter 컴포넌트를 렌더링합니다", () => { | |
| const { getByText } = render(<Counter />); | |
| getByText("Counter: 0"); | |
| getByText("+"); | |
| getByText("-"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # http://webapps.stackexchange.com/questions/39587/view-estimated-size-of-github-repository-before-cloning | |
| # tested on macOS | |
| echo https://github.com/torvalds/linux.git | perl -ne 'print $1 if m!([^/]+/[^/]+?)(?:\.git)?$!' | xargs -I{} curl -s -k https://api.github.com/repos/'{}' | grep size | |
| # output: | |
| # "size": 1746294, |