<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bee Bee Wijaya</title>
    <description>The latest articles on DEV Community by Bee Bee Wijaya (@beebeewijaya).</description>
    <link>https://dev.to/beebeewijaya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F284497%2F93548042-10d6-4fac-bd50-b77598f2dd3b.jpg</url>
      <title>DEV Community: Bee Bee Wijaya</title>
      <link>https://dev.to/beebeewijaya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/beebeewijaya"/>
    <language>en</language>
    <item>
      <title>Dark Mode Switch</title>
      <dc:creator>Bee Bee Wijaya</dc:creator>
      <pubDate>Wed, 08 Jan 2020 19:13:21 +0000</pubDate>
      <link>https://dev.to/beebeewijaya/dark-mode-switch-4j1o</link>
      <guid>https://dev.to/beebeewijaya/dark-mode-switch-4j1o</guid>
      <description>&lt;h1&gt;
  
  
  Switch Toggle in Dark Mode
&lt;/h1&gt;

&lt;p&gt;Switch toggle is quite troublesome when you just started in web design or web development. Because HTML element is not supported switch toggle like on/off stuff and you must style it alone using checkbox, i have create a codepen for switch toggle for Dark Mode and you can fork it and learn from it.&lt;/p&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--w5KoO5Lw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1178319287590588416/xh7fuJRH_normal.jpg" alt="3 EE~ profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        3 EE~
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        @beebee_wijaya
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--P4t6ys1m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      Hi everyone, recently i create a great dark mode toggle using checkbox and CSS for the styling, you can check this codepen and fork it for free! &lt;a href="https://t.co/32hPS2NTg9"&gt;codepen.io/bbw0706/projec…&lt;/a&gt; via &lt;a href="https://twitter.com/CodePen"&gt;@CodePen&lt;/a&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      19:03 PM - 08 Jan 2020
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1214986098222321664" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="/assets/twitter-reply-action.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1214986098222321664" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="/assets/twitter-retweet-action.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      0
      &lt;a href="https://twitter.com/intent/like?tweet_id=1214986098222321664" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="/assets/twitter-like-action.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
      0
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;I can't embed it because it using the codepen projects and dev.to didn't support it.&lt;/p&gt;

&lt;p&gt;Thank's for your time to read these stuff. Hopefully i will share more knowledge that i know to you all.&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>css</category>
      <category>javascript</category>
      <category>html</category>
    </item>
    <item>
      <title>Unit Testing with Javascript in a nutshell</title>
      <dc:creator>Bee Bee Wijaya</dc:creator>
      <pubDate>Thu, 02 Jan 2020 17:41:45 +0000</pubDate>
      <link>https://dev.to/beebeewijaya/unit-testing-with-javascript-in-a-nutshell-1e7j</link>
      <guid>https://dev.to/beebeewijaya/unit-testing-with-javascript-in-a-nutshell-1e7j</guid>
      <description>&lt;h1&gt;
  
  
  What is Unit Testing ?
&lt;/h1&gt;

&lt;p&gt;Unit testing usually test a small part of the code. For example we test a function, we input something and we expect the function return something.&lt;/p&gt;

&lt;p&gt;Look add the code in app.js below&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We have a function named sum and it accept a &amp;amp; b arguments, and the function return the sum of a &amp;amp; b.&lt;/p&gt;

&lt;p&gt;You're good ? Nice, now how we test this function and make sure it works like what we expected ?.&lt;/p&gt;

&lt;h2&gt;
  
  
  First let me introduced you to Jest
&lt;/h2&gt;

&lt;p&gt;What is Jest ? it's just a testing library created and maintained by Facebook and you can find it more to learn in &lt;a href="https://jestjs.io/docs/en/getting-started"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But keep this in your head when you read this article, it doesn't matter if you not learn all the stuff in Jest, because you can still look up on it everytime you need the methods, it just syntax matter. What i mean is you must learn the concept and not the library.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generate some new Projects
&lt;/h2&gt;

&lt;p&gt;Lets generate some new Express Project for making a unit test app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~ mkdir learn_ut
~ cd learn_ut
~/learn_ut touch app.js
~/learn_ut yarn init -y
~/learn_ut yarn add express
~/learn_ut yarn add -D jest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Right, we're good. If you confused on this stuff then keep it simple, We're just generate a light Express applicaton here using yarn.&lt;/p&gt;

&lt;p&gt;Now, let's config the jest in package.json file&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;br&gt;
I'm added the block code of Jest in that json file. What happened ? it just a small config for Jest to work on our project, That's all.&lt;/p&gt;

&lt;p&gt;Also i added the scripts tag for us to run easily, usually this called npm scripts. for example, i don't need to run &lt;code&gt;jest&lt;/code&gt; everytime on my terminal, so i just use &lt;code&gt;yarn test&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;All right, now let's create the test file and we must import the sum function in our test.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Oh my god, what's these new syntax ? &lt;/p&gt;

&lt;p&gt;It's just a normal test syntax, a &lt;code&gt;test()&lt;/code&gt; function is just like a statement of what you expect the return would be and it's accept a normal string in first argument and a callback in second argument, you can write whatever you want in first argument but i recommend you to write as what you expect the test would be.&lt;/p&gt;

&lt;p&gt;Let's talk about the callback statement, here i expect the sum of 1 &amp;amp; 2 will be 3. &lt;code&gt;expect()&lt;/code&gt; function is a Jest function and it has a bunch of method you can use like &lt;code&gt;toBe()&lt;/code&gt; or &lt;code&gt;toBeTruthy()&lt;/code&gt;etc.&lt;/p&gt;

&lt;p&gt;What happened when you run the test ? Let's try it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/learn_ut yarn test
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SeSis8mx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://beebeewijaya-image.s3.amazonaws.com/Screen%2BShot%2B2020-01-03%2Bat%2B00.35.36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SeSis8mx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://beebeewijaya-image.s3.amazonaws.com/Screen%2BShot%2B2020-01-03%2Bat%2B00.35.36.png" alt="Unit test result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All right!, we're done. &lt;/p&gt;

&lt;p&gt;That's all for a Unit Testing in a nutshell.&lt;br&gt;
I'm sorry if i can't write so good it's my first writing here, but i'm giving my best and i will contribute more in dev.to and for the Javascript community.&lt;/p&gt;

&lt;p&gt;Wait for my next article, Thank you very much!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>testing</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
