<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>TAMA_CHAN</author_name>
  <author_url>https://blog.hatena.ne.jp/TAMA_CHAN/</author_url>
  <blog_title>Kashiwara0205</blog_title>
  <blog_url>https://tama-chan.hatenadiary.jp/</blog_url>
  <categories>
  </categories>
  <description>概要 Jestを使ってClassのメソッドを一部Mockにしてテストを回す方法を記載します 結論 prototypeを使い該当メソッドを対象のテストファイルにてjest.fnで更新します // prototypeを使用してメソッドをmockに更新 Class.prototype.method = jest.fn() // 戻り値も定義したい場合、mockReturnValueを使用する Class.prototype.method = jest.fn().mockReturnValue(1) 例えば、MemberクラスのgetNameメソッドをmock化するなら Member.prototyp…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftama-chan.hatenadiary.jp%2Fentry%2F2021%2F01%2F05%2F141844&quot; title=&quot;Jestを使ってClassのメソッドを一部Mock化する方法 - Kashiwara0205&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-01-05 14:18:44</published>
  <title>Jestを使ってClassのメソッドを一部Mock化する方法</title>
  <type>rich</type>
  <url>https://tama-chan.hatenadiary.jp/entry/2021/01/05/141844</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
