CodeNewbie Community 🌱

Cover image for From Front Desk to Front End p.34 - Tech Test Interim and first Tests with Jest
Tauri StClaire
Tauri StClaire

Posted on

From Front Desk to Front End p.34 - Tech Test Interim and first Tests with Jest

Photo by Blaque X on Pexels. I dived right back into the ocean of programming this week after a vacation!

Hi, I'm Tauri!

I am a Front End Developer and a student (and enrollment counselor) with Skillcrush, the online coding and design school with a heart! I am looking for employment with a company, and working on adding to my skillset every day! This blog is chronicling my most recent projects, so thank you for reading!


I went on my first vacation of 10+ years last week! It was extremely refreshing, and I came back to some good news from some companies that want to move me forward in the interview process! One sent me a tech test so I was excited to leap into that right away.
In other news, I also hosted a webinar about Study Skills 101: How to Crush Your Online Course on Crowdcast this week, and the community engagement was AMAZING! Check it out!

Monday 6/5/23:

I got back today from my vacation and several hours of traveling by car. My brain was pretty mushy today but I was really excited a company wanted to move me forward and check out my skills, so I just did a little bit of research and laid down a little pseudocode.
I had recently had a great conversation with my Uncle who is a mobile software engineer in tech about what working in tech is like, and we chatted about some great topics like getting more women into tech, imposter syndrome, and the importance of TESTING within your programs. So this, as well as a question within the tech test, prompted to start learning more more about testing my JavaScript functions so I found this awesome resource from Gabriel Tanner's blog. I zeroed in on unit testing. Matchers were the most useful for the challenges that were set for me. The architecture of your functions is important when building in tests, and I was already familiar with the Single Responsibility Principle (SRP) from my training. [Look ahead to Sat to see how this research panned out for me.]
I started laying out the pseudocode for the tech test which was hosted on Replit and my first experience with this code editor. The challenge had had 2 parts. The first part was to find the prime numbers in an array then sort them from greatest to least. The second part was to find the factors of the numbers in an array and produce an array of arrays of all the factors without any repeats of a factor for a particular number.
I will NOT be sharing my process here today tho for the privacy of the company's process, and that's for you to figure out on your own tech tests. 😉

Tuesday 6/6/23:

I've solved the primary numbers algorithm before so I did as I've learned to do in the past. But as I'm doing it, I'm not quite happy with the method to just eliminate 0 and 1 because they are known not to be prime numbers. That's bc I already know the "wrong answers" and am sorting them out, but if the purpose of my program is to find primes then it should only eliminate those numbers bc it is able to check and verify that 0 and 1 do not meet the requirements of a prime number (must have 2 factors only). So I'm keeping this in mind as I trek along.

Wednesday 6/7/23:

I had to catch up on SO MUCH correspondence today that I didn't have time to code! Part of that was checking on the deadline for this particular tech test to which they replied "there is none" so I gave them a big thank you because I would like more time to get this test to be the best example of my current skills and abilities (which include diving right into learning new skills)!

Thursday 6/8/23:

I got working on the second part to produce the factors of the numbers in an array and give them an array of arrays of the factors (with no repeats of factors for a given number) bc I knew it would be useful to the quandary I had on Tuesday. I made sure my commentary of what the purpose of each section did was clear throughout.
I belatedly decided to make my own local code and private repo. It was nice for me to have a local copy so I could test out how it was doing within the format I'm most comfortable with so that I'd know if any hang-ups were due to my code or due to me just learning how Replit functions. It also allows me to keep up with my green squares on my Github profile! 😎
Also bc this was my first time using Replit, only just today did I discover that it has an amazing Git option that I hadn't been utilizing this whole time! D'oh! Now my second function was under much better version control!
So the initial commits for both of these are super late in the game! I guess that's what I get for launching into this right after coming back from vacation!🌞🌞🌞

Friday 6/9/23:

I recreated my function to create a sorted list of primes from a given array so that it was following the criteria of what a prime is: it divided the number by all numbers less than or equal to it, creating one factor for itself and ending once there were more than 2 factors. Then I made sure there were at least 2 factors, so this eliminated 1.

Saturday 6/10/23:

I was having a persistent issue where my functions were consoling out the results but doing so multiple times (but it wasn't doing so in my local repo!!). I repeatedly kept checking my JS in Replit to figure out what the issue was and couldn't find it. Today I overviewed my index.html document and recognized that it was already prepared to call the function with the upload of the index.html! I've never seen this before so that was a cool discovery! So I removed my call of the main higher-order function which called the two challenge functions as callbacks and bizoom, looked good!
I really want to learn more about inbuilt testing, so I took this as an opportunity!! I've never done any testing or used Jest before, so I started from the beginning.
Bc of my previous experience with using npm for Sass, I was ready to go when looking at the Jest documents instructing me to install with npm by downloading directly to my PATH. I did the example first, and I created a file for my function, a file for my test, and included the test in my package.json file according to Jest's Getting Started doc and totally got it to work!!!
Then I got my tests to run on my local repo too!! (So many high-fives given to myself). I'm definitely not advanced in my understanding of running tests with Jest however, so I had to neatly sort my separate functions and my tests into different files in order to get them to run correctly.

Sunday 6/11/23:

Unfortunately I couldn't get my tests to run on the Repl the company had set up for me. The Replits docs on Unit Testing indicated that the option to add Unit Tests was not made available to me within the given Repl. I experimentally created a Node.js Repl, which is how Jest is supported within Replit, and the options to add Unit Tests were given to me as demonstrated in the doc.
So I wound up this tech test today and tied it up with a ship-it bow, I.E. my ReadMe. I included a link to my local repo and code snippets of my Jest tests with an invitation to add anyone as a collaborator if they wanted to see it bc it's private.

I'm really proud of how I handled this tech test. I learned so much, and as my mom always taught me knowledge is one of the greatest treasures you can acquire for yourself because it's forever yours.

Top comments (0)