Latest Tutorials

Learn about the latest technologies from fellow newline community members!

  • React
  • Angular
  • Vue
  • Svelte
  • NextJS
  • Redux
  • Apollo
  • Storybook
  • D3
  • Testing Library
  • JavaScript
  • TypeScript
  • Node.js
  • Deno
  • Rust
  • Python
  • GraphQL
  • React
  • Angular
  • Vue
  • Svelte
  • NextJS
  • Redux
  • Apollo
  • Storybook
  • D3
  • Testing Library
  • JavaScript
  • TypeScript
  • Node.js
  • Deno
  • Rust
  • Python
  • GraphQL

    🎉 Announcing: Pain Free Mocking with Jest

    Ever felt like you're in a never-ending battle with automated testing and mocking? You spend hours coding, but when it comes to testing, it's like hitting a wall – confusing, frustrating, and time-consuming. We get it. Testing can be tough, especially mocking. It's like you need to be a detective and a coder at the same time. And the lack of clear, helpful guides out there doesn't make it any easier. That's why we've been working on something special to tackle this exact problem. We're thrilled to introduce Pain Free Mocking with Jest, a fresh, different approach to teaching you how to test complex applications without headaches. This isn't just another course. It's a game-changer. Designed for coders like you, it's filled with all the tricks and tips you need, packed into a series of easy-to-digest lessons that you can finish in just a single afternoon. Here's a sneak peek at what we have in store for you in Pain Free Mocking with Jest: And more! To kick things off, we're offering a 14% discount for the next 4 days, until 02/23. We're making this amazing learning opportunity as accessible as possible because we can't wait to help you conquer testing and mocking. Ready to transform your testing skills and gain confidence in just one afternoon? Don’t let this opportunity slip away. Check out Pain Free Mocking with Jest today and step up your coding game!

      How To Mock HTTP Requests with Jest: A Step-By-Step Guide

      When testing web applications, there’s always a part where you have to test your Controllers. Be it a request to your own server or an 3rd party API, one thing’s for certain: You’ll have to test a function that contains an HTTP request. And after reading this blog post, you’ll know exactly how to do that using the Jest testing framework. Jest stands out as a testing framework for several reasons: Let's start by setting up a project with Jest: These steps lay the foundation for integrating Jest into your project. Consider a function that makes an API call, such as fetching user data. Here's an example using axios: Now, we need to test our function: Congratulations! You now have a working test with Jest and mocking. Understanding how to mock HTTP requests in Jest is a crucial skill for any software engineer working with modern web applications. Stay tuned for more advanced techniques and deeper dives into Jest’s capabilities in our upcoming posts.

      I got a job offer, thanks in a big part to your teaching. They sent a test as part of the interview process, and this was a huge help to implement my own Node server.

      This has been a really good investment!

      Advance your career with newline Pro.

      Only $30 per month for unlimited access to over 60+ books, guides and courses!

      Learn More

        Common Mocking & Testing Mistakes That Ruin Your Test Cases

        Testing is all the rage right now. With Test-Driven Development being so popular, unit tests have become the new hot thing. That being said, automated testing isn't just a trend, it's a fundamental practice in software engineering for ensuring quality. Techniques like Test-Driven Development (TDD) highlight the importance of unit tests, which have become a cornerstone of modern software development. But did you know there are a lot of hidden testing mistakes a lot of us make? Some have to do with the test cases themselves. Some have to do with our mocking implementations. Yet they all make our tests flawed without us knowing until it’s too late. Let’s see what are some of those testing traps. Mocking is a powerful tool in unit testing, but it's easy to get it wrong. A common issue is oversimplifying mock behavior or not accurately reflecting edge cases. As an engineer, you might be familiar with the basics of mocking and unit testing. However, if you’re interested in learning some more advanced techniques and concepts like: You might be interested in “Pain Free Mocking with Jest”, which is coming out this Monday and is designed to help you test simple and complex real-world applications using Mocks, Stubs, and Spies, without the headaches. Testing is an art, and mastering it requires continuous learning and adaptation. By avoiding common testing mistakes and properly using mocking, you can ensure that your software is not only functional but also robust and reliable.

          Unit Testing and Mocking Mistakes That Produce Headaches

          Testing. We all know it’s a critical part of our job, right? But let’s face it, it can be tricky. Whether you're just starting out or have been at it for years, there's always a chance you might slip up in unit testing and mocking. But don't worry, I've got you covered. In this post, we'll explore some common mistakes and how to steer clear of them. Unit testing is like the superhero of the software world. It saves us countless hours of manual testing and helps catch those pesky bugs. But did you know the average project only has about 40% test coverage, while the recommended is a whopping 80%? That's a lot of untested code! Let’s dive into why that happens and how we can do better. When you're dealing with a huge codebase, running all tests can take hours. If you're short on time, prioritize your tests. Integration tests often provide better reliability over unit tests because of their wider scope. So, when in doubt, focus on integration tests to ensure your code is solid. Conclusion Unit testing is a skill that can always be improved. By avoiding these common pitfalls, you can make your testing process more efficient and effective. Remember, the goal is to catch bugs early and save time in the long run. So next time you sit down to test, keep these tips in mind and you’ll be on your way to becoming a unit testing pro!

            How To Transition from Angular Observables to Signals

            The Angular framework has recently undergone a significant transformation with the introduction of Signals in Angular 17. This change marks a pivotal shift from the traditional use of RxJS Observables to a more streamlined approach to state management. This blog post aims to guide developers through this transition, highlighting the key differences and offering strategies for adapting to this new paradigm. The introduction of Signals in Angular, provides as alternative means of handling state and reactivity in Angular. Compared to Observables, known for their power in managing asynchronous data streams, have been integral to Angular applications. However, their complexity often made them daunting for many developers. Signals, on the other hand, offer a simpler, more direct way to manage state. promising to enhance both performance and developer experience. Signals in Angular bring several benefits over Observables: For developers accustomed to Observables, transitioning to Signals requires a shift in mindset. Here are some strategies to ease this process: Despite their benefits, adopting Signals comes with its own set of challenges: The introduction of Signals in Angular 17 is a game-changer for developers. It simplifies state management, enhances application performance, and encourages cleaner code practices. While the transition from Observables to Signals may present challenges, it offers a promising path forward for Angular developers. Embracing this change will not only improve your applications but also keep your skills relevant in the ever-evolving landscape of web development.