It's dan 2@Itsdanagain2
🚀 Day 16 — My Journey to Becoming a Frontend Software Developer
Another day of learning, another step closer to becoming the frontend developer I aspire to be. Today, I learned about one of the most important parts of software development: Testing.
Testing is important because it helps us find bugs, confirm that our code works correctly, and make sure that changes we make to our code don't break existing features.
Today's lesson introduced me to different types of testing, test cases, test suites, testing frameworks, mocks, spies, integration tests, and hooks.
📚 What I Learned Today
🔹 1. Manual and Automated Tests
I learned the difference between manual testing and automated testing.
Manual testing involves checking our software ourselves to see if everything works as expected.
Automated testing uses code to automatically test our code and check if it produces the expected results.
Automated testing is useful because it allows us to run tests quickly and repeatedly, especially when working on larger projects.
🔹 2. Test Cases and Test Suites
I learned that a test case is an individual test that checks whether a specific part of our code works correctly.
A test suite is a collection of related test cases that are grouped together.
This makes it easier to organize our tests and check different parts of an application.
🔹 3. Testing Frameworks
I learned that a testing framework is a tool that makes it easier to write and run automated tests.
Instead of creating everything from scratch, testing frameworks provide useful features and tools that help developers test their code more efficiently.
🔹 4. Mocks and Spies
I learned about mocks and spies and how they can be used when testing code.
A mock can imitate something that our code depends on, while a spy allows us to monitor a method or function and check how it was used.
For example, I learned how to spy on "localStorage.setItem()" to check whether it was called and what values were passed to it.
🔹 5. Testing Web Pages with Integration Tests
I learned about integration testing, which allows us to test how different parts of an application work together.
Instead of testing only one small function, integration tests can check whether multiple parts of a web page or application work correctly together.
This is useful for testing real-world features and interactions.
🔹 6. Hooks
I learned about testing hooks such as:
• "beforeEach()"
• "afterEach()"
"beforeEach()" allows us to run setup code before each test.
"afterEach()" allows us to run cleanup code after each test.
Hooks help reduce repeated code and make our tests cleaner and easier to maintain.
📝 Exercises Completed
To reinforce today's lesson, I completed the Testing exercises.
✅ Added a test case for "formatCurrency(2000.4)" to check that the number is correctly rounded down to the nearest cent.
✅ Added another test case for "formatCurrency()" using a negative number.
✅ Re-ran all tests to make sure the code was working correctly.
✅ Used ".toHaveBeenCalledWith()" to check the exact values received by a mocked method.
✅ Tested "localStorage.setItem()" to make sure the correct values were saved.
✅ Used "JSON.stringify()" to convert the cart array into a string before checking the value saved to "localStorage".
✅ Added another test to check that "localStorage.setItem()" received the correct values.
✅ Created a "beforeEach()" hook in "cartTest.js" and moved the "spyOn(localStorage, 'setItem')" setup code inside it so the setup could be shared between tests.
✅ Created an "afterEach()" hook in "orderSummaryTest.js" and moved the cleanup code inside it.
💡 What This Lesson Taught Me
Today's lesson helped me understand that writing code is only one part of software development. We also need to make sure that our code actually works correctly.
Testing gives developers confidence when building and changing applications because we can automatically check whether our code is behaving as expected.
I also learned that good testing can help us catch bugs early, prevent existing features from breaking, and make our applications more reliable.
Every lesson reminds me that becoming a software developer isn't about memorizing code—it's about understanding how software is built, tested, improved, and maintained.
I'm committed to staying consistent, practicing every day, and documenting this journey publicly. My goal is not just to learn JavaScript, but to become a skilled Frontend Software Developer capable of building modern, reliable, and functional web applications.
Day 16 ✅
The journey continues. On to Day 17. 💻🔥
#BuildInPublic #JavaScript #FrontendDevelopment #SoftwareDeveloper #100DaysOfCode #CodingJourney #LearnInPublic #WebDevelopment