it('should return 404 when productId is not exist', async () => { const res = await request(app).get('/products/610a7f33b63caa3699ed9911'); expect(res.statusCode).toBe(404); // expect(res._isEndCalled()).toBeTruthy(); // 이건 왜 안될까요? }); 단위 테스트에서 수행하던 res._isEndCalled()는 node-mocks-http에서 createResponse()를 통해서 생성된 경우에만 테스트가 가능한 걸까요?
안녕하세요 강의가 너무 좋아서 한번더 퀵하게 복습 중인데, 그 사이에 mongoose의 메이저버전이 6으로 올라갔습니다. getProducts 통합 테스트할때, 전체 테스트(npm test)를 하면 오류가 안나지만, jest extension을 이용해서 아래 테스트만 진행하면 오류가 나네요. it('GET /products', async () => { const res = await request(app).get('/products'); expect(res.statusCode).toBe(200); expect(Array.isArray(res.body)).toBeTruthy(); expect(res.body[0].name).toBeDefined(); expect(res.body[0].description).toBeDefined(); }); 검색해서 좀 알아봐도 뚜렷한 답이 안나와서 혹시 아시는 내용인지 문의 드립니다. 참고로 결과 공유 드립니다 ➜ tdd2 node '/Users/lyunhokim/dev/tdd2/node_modules/.bin/jest' '/Users/lyunhokim/dev/tdd2/test/integration/products.int.test.js' -t 'GET /products' console.log Server is running... at Server.<anonymous> (server.js:23:11) console.log connected at server.js:11:11 FAIL test/integration/products.int.test.js (5.734 s) ✕ GET /products (5007 ms) ○ skipped POST /products ○ skipped should return 500 on POST /products ● GET /products MongoInvalidArgumentError: Method "collection.find()" accepts at most two arguments at Collection.find (node_modules/mongodb/src/collection.ts:733:13) at NativeCollection.<computed> [as find] (node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:191:33) at NativeCollection.Object.<anonymous>.Collection.doQueue (node_modules/mongoose/lib/collection.js:135:23) at node_modules/mongoose/lib/collection.js:82:24 ● GET /products thrown: "Exceeded timeout of 5000 ms for a test. Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test." 22 | }); 23 | > 24 | it('GET /products', async () => { | ^ 25 | const res = await request(app).get('/products'); 26 | expect(res.statusCode).toBe(200); 27 | expect(Array.isArray(res.body)).toBeTruthy(); at Object.<anonymous> (test/integration/products.int.test.js:24:1) at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13) Test Suites: 1 failed, 1 total Tests: 1 failed, 2 skipped, 3 total Snapshots: 0 total Time: 5.778 s Ran all test suites matching /\/Users\/lyunhokim\/dev\/tdd2\/test\/integration\/products.int.test.js/i with tests matching "GET /products". Jest did not exit one second after the test run has completed. This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
[표준 스트림과 파일 디스크립터] 강좌를 보는데, 프로세스의 표준 입출력은 모두 파일 디스크립터라고 말씀해주셨는데, 파일 디스크립터 설명 부분에서 파일 디스크립터는 "파일을 대변하는 객체" 라고 말씀해주셨습니다. 그렇다면 표준 입출력은 "어떤 파일"을 대변하는 건가요??
Liquid Exception: Invalid character in host: '<username>.github.io' in /_layouts/base.html jekyll 3.8.6 | Error: Invalid character in host: '<username>.github.io' . . . C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/addressable-2.7.0/lib/addressable/uri.rb:2475:in `validate': Invalid character in host: '<username>.github.io' (Addressable::URI::InvalidURIError) 이런 오류는 어떤식으로 해결해야 할까요??
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 안녕하세요 선생님! 이러한 에러가 납니다. . . log4j를 잘못설정한것같습니다 log4j 를 잘못설정한 것일까요?? 혹시 몰라서 다른 부분도 첨부해보겠습니다 -Mapper -Reducer -Driver pom.xml Run Configuration
const checkWinner = (target) => { let rowIndex; let cellIndex; rows.forEach((row, ri) => { row.forEach((cell, ci) => { if(cell === target) { rowIndex = ri; cellIndex = ci; console.log(ri,ci) } }) }) let hasWinner = false; if( rows[rowIndex][0].textContent === turn && rows[rowIndex][1].textContent === turn && rows[rowIndex][2].textContent === turn ){ hasWinner = true; } console.log(hasWinner) } 소스를 보면 위와같이 forEach문을 사용해서 현재 내가 클릭한 row,cells의 index값을 가져오는 소스입니다. 소스를 분석해보면 클릭한 위치를 찾기 위해서는 위와같은 소스가 만들어져야 한다는 것을 알 수 있습니다. 그런데 앞장부터 책을 보면서 진행을 하다보면 생각하는 과정이 어떻게 되서 위와같은 checkWinner라는 함수를 만들고 그 안에서 forEach를 사용해서 만들어지는지 전혀 모르겠어요.ㅠㅠ 그러니까.. [ [td], [td], [td] [td], [td], [td] [td], [td], [td] ] 이런식으로 배열이 만들어져서 그중에 2행 2열의 td의 클릭한 값을 가져오기 위해서는 제로초님이 만드신 forEach문을 사용해서 가져오면 된다는것은 알 수 있는데.. 그런 소스가 만들어지기까지의 과정을 모르겠습니다. 어떻게 생각을 하고, 어떤 방향으로 고민을 해야 만들어질 수 있는지 훈련을 할려면 어떻게 해야할까요?? 결론적으로. 소스를 보면 과정들이 이해가 가는데.. checkWinner라는 함수를 생각해내는 것 까지는 어렵지는 않은데(복잡해지니까 기능단위로 따로 빼면 되니까요) checkWinner라는 함수 안에 forEach를 사용해서 문제를 하결하는 과정은 입문자 입장에서는 아무리 고민을 하고, 이해를 하려고 해도 쉽지가 않습니다.ㅠㅠ 이럴 경우에는 어떤식으로 진행을 하고, 고민을 하고 공부를 해야하는지 조언 부탁드립니다.ㅜㅠㅜ
npm i next-redux-wrapper 입력시 npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: react-nodebird-front@1.0.0 npm ERR! Found: next@9.5.5 npm ERR! node_modules/next npm ERR! next@"^9.5.5" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer next@">=10.0.3" from next-redux-wrapper@7.0.2 npm ERR! node_modules/next-redux-wrapper npm ERR! next-redux-wrapper@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See C:\Users\정민수\AppData\Local\npm-cache\eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\정민수\AppData\Local\npm-cache\_logs\2021-08-29T03_51_14_259Z-debug.log 이런 에러가 발생하는데 혹시 문제점이 어떤 것인지, 그리고 해결방법이 어떻게 되는지 알 수 있을까요?
아래와 같이 http method는 다르지만 URL이 같은 경우, (조회 : GET /members, 등록 : POST /members) 서비스 접근제어는 보통 URL기반으로 처리하므로 등록권한을 따로 분리할 수 없고, 이럴 경우는 컨트롤 URL을 사용할 수 밖에 없을 것 같은데요. (등록: POST /members/regist) 그렇다면 실무에서는 운영 중에 권한이 생기거나 변경될 수도 있으니, 처음부터 컨트롤 URL을 적극 사용하여 API URL을 설계하는 게 맞는 것 같은데, (--> 조회 : GET /members/search, 등록 : POST /members/regist) 접근제어 처리 관점에서 API URL 설계는 어떻게 하는게 효율적일까요?
그 전의 강의들보면 vector선언하실 때 예) vector <int> vec = {1,2,3,4} ; 이런식이였는데요 여기서 vector <int> vec(10); 을 벡터 10개라고 하셨는데 벡터 10개라는의미가 vec =이 vec벡터 1개로 10칸의 배열을 의미한다는 것인가요? 아니면 10개의 벡터가 만들어졌다는 뜻인가요?
이상하게 선생님과 달리 전 로그 쿼리가 두번이 찍히더라구요. 모든 로그파일이 2번씩 찍힙니다. drop 도 마찬가지고 create 도 마찬가지고 insert update 등등 해결해보려고 검색도 해보는데 마땅히 해결방안을 찾지를 못하고 있어서.... 죄송합니다.(전 H2가 아닌 mysql을 사용하고 있긴한데 이게 이런 현상을 발생시키는지는 잘 모르겠습니다 ㅠ) ========================================= create table Album ( artist varchar(255), etc varchar(255), ITEM_ID bigint not null, primary key (ITEM_ID) ) engine=MyISAM Hibernate: create table Album ( artist varchar(255), etc varchar(255), ITEM_ID bigint not null, primary key (ITEM_ID) ) engine=MyISAM 10:41:04.346 [main] INFO org.hibernate.orm.connections.access - HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@152c4495] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 안녕하세요 선생님 !! :) ㅇdataa=n ew Text(CovidData[3]) ; 이부분이랑 밑에 Covid Data[8] ; 여기요, 어떤 기준(이유)으로 CovidData[3]. CovidData[8] 을 설정하신 건지 궁금합니다! date변수에 인덱스3부분에 해당하는 날짜를 넣은것인가요?