이번에야말로 모킹을 통해 유닛테스트를 작성해보자. 왜 필요한가? 솔직히 이걸 제대로 이해하지 못해서 계속 모킹이라는 것을 이해하지 못했던 것 같다. https://0422.tistory.com/294 Docker compose로 테스트 코드 환경 구성하기(express + TypeORM) - typeORM, Jest 설정 컨테이너 설정은 다했으니 TypeORM과 Jest의 설정을 해보자. Data-Source.ts 일단 나는 DataSource방식으로DAO코드를 작성했다. https://orkhan.gitbook.io/typeorm/docs/data-source Working with DataSource - typeorm Generally, you ca 0422.tistory.com 이전에 적었던 글을 ..
컨테이너 설정은 다했으니 TypeORM과 Jest의 설정을 해보자. Data-Source.ts 일단 나는 DataSource방식으로DAO코드를 작성했다. https://orkhan.gitbook.io/typeorm/docs/data-source Working with DataSource - typeorm Generally, you call initialize method of the DataSource instance on application bootstrap, and destroy it after you completely finished working with the database. In practice, if you are building a backend for your site and you..
개념 버블 정렬은 처음부터 끝-1의 인덱스에 대해서 해당 인덱스의 오른쪽 값과 비교하여 값을 변경해주는, 간단한 정렬 알고리즘이다. 실제 값끼리 수를 비교하여 진행하므로 비교기반의 알고리즘이고, 추가적인 메모리가 필요하지 않다. 구현 const bubbleSort = (inputArray) => { for (let x = 0; x inputArray[currentIndex + 1]) { let temp = inputArray[currentIndex +..
javascript로 여러 알고리즘을 구현하고 jest를 통해서 결과를 확인해 볼 것이다. 프로젝트 폴더를 구성해주자. npm init npm init -y jest 설치 및 세팅 npm i jest npm test를 했을때, jest가 실행되게 하고싶으니깐 package.json에 이렇게 작성해줬다. { ... scripts:{ "test" : "jest" }, ... } 이러고 jest를 실행시키면... 실행이 안될꺼다. jest는 바벨이 필요하다. 기본적으로 es5 구문으로 해석하기 때문이라고 한다. https://gatsbybosungblogmain.gatsbyjs.io/tdd3/ Jest에서 왜 babel이 필요한가? Jest에서 왜 babel이 필요한가? gatsbybosungblogmain...