<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Nestjs on Importunate</title>
    <link>https://importunate-dev.github.io/series/nestjs/</link>
    <description>Recent content in Nestjs on Importunate</description>
    <generator>Hugo</generator>
    <language>ko</language>
    <lastBuildDate>Fri, 27 Oct 2023 00:00:00 +0900</lastBuildDate>
    <atom:link href="https://importunate-dev.github.io/series/nestjs/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Teamsparta Devcamp를 마치며</title>
      <link>https://importunate-dev.github.io/posts/2023-10-27-nestjs231027/</link>
      <pubDate>Fri, 27 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-27-nestjs231027/</guid>
      <description>회고</description>
    </item>
    <item>
      <title>JWT와 코드 분석</title>
      <link>https://importunate-dev.github.io/posts/2023-10-12-nest231012/</link>
      <pubDate>Thu, 12 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-12-nest231012/</guid>
      <description>NestJS</description>
    </item>
    <item>
      <title>NestJS에 대하여</title>
      <link>https://importunate-dev.github.io/posts/2023-10-11-nest231011/</link>
      <pubDate>Wed, 11 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-11-nest231011/</guid>
      <description>심화 데브캠프 1일차</description>
    </item>
    <item>
      <title>App Configuration</title>
      <link>https://importunate-dev.github.io/posts/2023-10-10-nest231010-2/</link>
      <pubDate>Tue, 10 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-10-nest231010-2/</guid>
      <description>테스트를 위한 환경변수와 DB 이원화</description>
    </item>
    <item>
      <title>Association</title>
      <link>https://importunate-dev.github.io/posts/2023-10-10-nest231010-3/</link>
      <pubDate>Tue, 10 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-10-nest231010-3/</guid>
      <description>두 클래스간의 연관 관계</description>
    </item>
    <item>
      <title>end to end testing</title>
      <link>https://importunate-dev.github.io/posts/2023-10-10-nest231010-1/</link>
      <pubDate>Tue, 10 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-10-nest231010-1/</guid>
      <description>global middleware 옮기기</description>
    </item>
    <item>
      <title>TypeORM으로 쿼리 작성</title>
      <link>https://importunate-dev.github.io/posts/2023-10-10-nest231010-5/</link>
      <pubDate>Tue, 10 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-10-nest231010-5/</guid>
      <description>쿼리빌더 생성</description>
    </item>
    <item>
      <title>승인 시스템</title>
      <link>https://importunate-dev.github.io/posts/2023-10-10-nest231010-4/</link>
      <pubDate>Tue, 10 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-10-nest231010-4/</guid>
      <description>권한과 쿼리</description>
    </item>
    <item>
      <title>Authentication, Cookie-session</title>
      <link>https://importunate-dev.github.io/posts/2023-10-09-nestjs231009-1/</link>
      <pubDate>Mon, 09 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-09-nestjs231009-1/</guid>
      <description>로그인과 회원가입</description>
    </item>
    <item>
      <title>Authentication와 Guard</title>
      <link>https://importunate-dev.github.io/posts/2023-10-09-nestjs231009-2/</link>
      <pubDate>Mon, 09 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-09-nestjs231009-2/</guid>
      <description>권한없는 요청 거부하기</description>
    </item>
    <item>
      <title>단위 테스트</title>
      <link>https://importunate-dev.github.io/posts/2023-10-09-nestjs231009-3/</link>
      <pubDate>Mon, 09 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-09-nestjs231009-3/</guid>
      <description>&lt;h1 id=&#34;unit-testing&#34;&gt;Unit Testing&lt;/h1&gt;
&lt;h2 id=&#34;유닛-테스트-과정&#34;&gt;유닛 테스트 과정&lt;/h2&gt;
&lt;p&gt;Fake UsersService를 만들어서 실행할 계획이다. 정상적으로 애플리케이션을 실행하면 DI 안에 많은 종속성을 넣어야 한다. 우린 새롭게 테스트를 위한 DI를 만드는데, 내부에는 Userss Service의 모든 메서드를 실행하는 클래스를 담는다. 이로서 어떤 단위(ex. Authentication, sign in 등)을 테스트하는데 종속성 주입에서 자유로워질 수 있다.&lt;/p&gt;
&lt;h3 id=&#34;test-설정하기&#34;&gt;Test 설정하기&lt;/h3&gt;
&lt;p&gt;users 디렉토리에 auth.service.spec.ts 파일을 만들자&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;
&lt;table style=&#34;border-spacing:0;padding:0;margin:0;border:0;&#34;&gt;&lt;tr&gt;&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt; 1
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt; 2
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt; 3
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt; 4
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt; 5
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt; 6
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt; 7
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt; 8
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt; 9
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;10
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;11
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;12
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;13
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;14
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;15
&lt;/span&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;16
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td style=&#34;vertical-align:top;padding:0;margin:0;border:0;;width:100%&#34;&gt;
&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-ts&#34; data-lang=&#34;ts&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// auth.service.spec.ts
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;import&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;Test&lt;/span&gt; } &lt;span style=&#34;color:#66d9ef&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;@nestjs/testing&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;import&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;AuthService&lt;/span&gt; } &lt;span style=&#34;color:#66d9ef&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;./auth.service&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;import&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;UsersService&lt;/span&gt; } &lt;span style=&#34;color:#66d9ef&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;./users.service&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;it&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;can create an instance of auth service&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;async&lt;/span&gt; () &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;// 새 DI container 생성
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;// 하지만 AUthService를 위한 종속성을 제공하지 않았으니 실행하면 오류가 뜰것이다.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;constmudle&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;await&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Testing&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;createTestingModule&lt;/span&gt;({
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#a6e22e&#34;&gt;providers&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;[&lt;span style=&#34;color:#a6e22e&#34;&gt;AuthService&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }).&lt;span style=&#34;color:#a6e22e&#34;&gt;compile&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;service&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;module&lt;/span&gt;.&lt;span style=&#34;color:#66d9ef&#34;&gt;get&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;AuthService&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;expect&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;service&lt;/span&gt;).&lt;span style=&#34;color:#a6e22e&#34;&gt;toBeDefined&lt;/span&gt;();
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;});
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;터미널에서 &lt;code&gt;npm run test:watch&lt;/code&gt;를 입력한다. 3개가 failed라고 뜰텐데, p를 누르고 &lt;code&gt;auth.service.spec&lt;/code&gt; 을 입력한다. 그럼 이 파일만 테스트하여 1 failed라고 뜬다.&lt;/p&gt;</description>
    </item>
    <item>
      <title>데이터 직렬화</title>
      <link>https://importunate-dev.github.io/posts/2023-10-08-nest231008-1/</link>
      <pubDate>Sun, 08 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-08-nest231008-1/</guid>
      <description>custom Interceptor 만들</description>
    </item>
    <item>
      <title>Data 처리 및 저장</title>
      <link>https://importunate-dev.github.io/posts/2023-10-07-nest231007-4/</link>
      <pubDate>Sat, 07 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-07-nest231007-4/</guid>
      <description>User 데이터 처리 API</description>
    </item>
    <item>
      <title>Nest 아키텍처 : 모듈</title>
      <link>https://importunate-dev.github.io/posts/2023-10-07-nest231007-1/</link>
      <pubDate>Sat, 07 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-07-nest231007-1/</guid>
      <description>종속성 주입(DI) 이해해보기</description>
    </item>
    <item>
      <title>NestJS 프로젝트 : 기획 및 구성</title>
      <link>https://importunate-dev.github.io/posts/2023-10-07-nest231007-2/</link>
      <pubDate>Sat, 07 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-07-nest231007-2/</guid>
      <description>App flow, API, 모듈 생각해보기</description>
    </item>
    <item>
      <title>TypeORM으로 데이터 처리하기</title>
      <link>https://importunate-dev.github.io/posts/2023-10-07-nest231007-3/</link>
      <pubDate>Sat, 07 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-07-nest231007-3/</guid>
      <description>API 기획하고 회원가입 만들기</description>
    </item>
    <item>
      <title>Nest 아키텍처 : 서비스와 레포지토리</title>
      <link>https://importunate-dev.github.io/posts/2023-10-06-nest231006/</link>
      <pubDate>Fri, 06 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-06-nest231006/</guid>
      <description>제어 역전과 종속성 주입</description>
    </item>
    <item>
      <title>Nest CLI로 프로젝트 생성하기</title>
      <link>https://importunate-dev.github.io/posts/2023-10-05-nest231005-4/</link>
      <pubDate>Thu, 05 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-05-nest231005-4/</guid>
      <description>계획과 모듈, 컨트롤러 생성</description>
    </item>
    <item>
      <title>NestJS 기초</title>
      <link>https://importunate-dev.github.io/posts/2023-10-05-nest231005-3/</link>
      <pubDate>Thu, 05 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-05-nest231005-3/</guid>
      <description>시작해보기</description>
    </item>
    <item>
      <title>요청 데이터의 Validation</title>
      <link>https://importunate-dev.github.io/posts/2023-10-05-nest231005-5/</link>
      <pubDate>Thu, 05 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-05-nest231005-5/</guid>
      <description>Data Transfer Object</description>
    </item>
    <item>
      <title>인터페이스</title>
      <link>https://importunate-dev.github.io/posts/2023-10-05-nest231005-1/</link>
      <pubDate>Thu, 05 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-05-nest231005-1/</guid>
      <description>Typescript 언어</description>
    </item>
    <item>
      <title>클래스</title>
      <link>https://importunate-dev.github.io/posts/2023-10-05-nest231005-2/</link>
      <pubDate>Thu, 05 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-05-nest231005-2/</guid>
      <description>Typescript 언어</description>
    </item>
    <item>
      <title>Type</title>
      <link>https://importunate-dev.github.io/posts/2023-10-04-nest231004-2/</link>
      <pubDate>Wed, 04 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-04-nest231004-2/</guid>
      <description>Typescript 언어</description>
    </item>
    <item>
      <title>Typescript 언어의 특징 알아보기</title>
      <link>https://importunate-dev.github.io/posts/2023-10-04-nest231004-1/</link>
      <pubDate>Wed, 04 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-04-nest231004-1/</guid>
      <description>Udemy 강의</description>
    </item>
    <item>
      <title>배열과 튜플</title>
      <link>https://importunate-dev.github.io/posts/2023-10-04-nest231004-3/</link>
      <pubDate>Wed, 04 Oct 2023 00:00:00 +0900</pubDate>
      <guid>https://importunate-dev.github.io/posts/2023-10-04-nest231004-3/</guid>
      <description>Typescript 언어</description>
    </item>
  </channel>
</rss>
