Profile

Work

I am a Full-Stack Web & Software Developer with over fifteen years of experience. Over countless hours I have discovered that I have a passion and talent for creating works that are both highly functional and technically sound.

I have also discovered that I have a knack for understanding new theories & concepts – I am an adamant perfectionist when it comes to just about anything I do.

Current Skill set

Web
  • Responsive Mobile first HTML & CSS3 – Bootstrap, SASS
  • JavaScript (Vanilla JS, JQuery, Angular)
  • PHP (Web Server & CRON)
  • CRM / CMS packages – WordPress, OsCommerce, Marketo
  • MySQL
  • Git
  • SEO & PPC
Applications
  • Java
  • Python
Legacy Technology
  • ASP (classic)
  • Visual Basic
  • Adobe Flash
Software Packages
  • Adobe Photoshop
  • MySQL
  • Jet Brains Web Suite
  • Microsoft Word
  • Microsoft Excel
  • Microsoft Access
  • Maya 3d
  • and more…

Study

At the start of 2019, I am entering my 4th year of a 6 year course Studying a Bachelor of
Computer Science with gaming specialisation at Charles Sturt University

Hobbies

Pyrotechnic

A license Pyrotechnician in the state of N.S.W. Australia for over twenty years, performing
professional grade pyrotechnic shows ranging from from Chinese String Crackers, Indoor Close
Proximity Fireworks, Aerial Shells up to 125mm and Aerial Salutes up to 75mm.

A founding member of the Pyrotechnics Industry Association of Australia (PIAA), Based in Sydney
but have performing shows all over NSW for all types of events.

Car Enthusiast

An active member in the Skylines Australia NSW car club I regularly volunteer to help run events.

Social Media

You can connect with me professionally on LinkedIn,
or stalk me through Twitter

Portfolio

Employment

Wizardry Fireworks

PRODOCOM Australia

Hannover Fairs Australia

E-Web Marketing

Freelance Websites

Personal Projects

Tipping Comp

cruizen’

National Pyrotechnics

iblott accessories

Blog

Comprehensive Guide to Jest Testing: Everything You Need to Know

When it comes to testing JavaScript applications, Jest stands out as one of the most popular and reliable tools in the developer community. Whether you’re building a small project or managing a large enterprise application, Jest provides a robust framework to ensure the stability and reliability of your code. In this article, we’ll explore what Jest testing is, its key features, and how you can get started with it.

What is Jest Testing?

Jest is an open-source JavaScript testing framework developed by Facebook. It is primarily designed for testing React applications but works seamlessly with other JavaScript frameworks, including Vue.js, Angular, and Node.js. Jest aims to deliver a simple, zero-config experience for developers while offering advanced features for robust testing.

Key Features of Jest:

  1. Zero Configuration: Jest works out of the box for most JavaScript projects without any need for complex setup.
  2. Snapshot Testing: Capture and compare the state of UI components to detect unexpected changes.
  3. Mocking Capabilities: Easily mock functions, modules, or APIs for controlled test environments.
  4. Code Coverage: Automatically generate detailed reports to track the extent of your code being tested.
  5. Parallel Test Execution: Leverage multi-threading to run tests faster.

Why Choose Jest for Your Project?

Here are some compelling reasons to make Jest your go-to testing tool:

  1. Ease of Use: Jest’s intuitive API makes it beginner-friendly, yet powerful enough for advanced users.
  2. All-in-One Solution: With built-in assertions, mocking, and code coverage, Jest eliminates the need for additional libraries.
  3. Active Community: Jest’s large and active community ensures ongoing updates, plugins, and support.
  4. Cross-Platform: Test both client-side and server-side JavaScript applications with a single framework.

Getting Started with Jest Testing

Step 1: Installation

Jest is easy to install using npm or yarn. Run the following command in your terminal:

# Using npm
npm install --save-dev jest

# Using yarn
yarn add --dev jest

Step 2: Writing Your First Test

Create a file named sum.js with the following code:

function sum(a, b) {
  return a + b;
}
module.exports = sum;

Next, create a test file named sum.test.js:

const sum = require('./sum');

test('adds 1 + 2 to equal 3', () => {
  expect(sum(1, 2)).toBe(3);
});

Run the test using the command:

npx jest

You should see the test pass successfully!

Step 3: Using Matchers

Jest provides a wide range of matchers to validate different types of data. Some common ones include:

  • toBe(value) for primitive values
  • toEqual(object) for objects and arrays
  • toContain(item) for arrays
  • toHaveLength(number) for checking array or string length

Example:

test('object assignment', () => {
  const data = { one: 1 };
  data['two'] = 2;
  expect(data).toEqual({ one: 1, two: 2 });
});

Advanced Jest Features

1. Snapshot Testing

Snapshot testing is ideal for verifying UI components. Jest saves the rendered output of a component and compares it in subsequent test runs.

Example:

import renderer from 'react-test-renderer';
import MyComponent from './MyComponent';

test('renders correctly', () => {
  const tree = renderer.create(<MyComponent />).toJSON();
  expect(tree).toMatchSnapshot();
});

2. Mock Functions

Mocking allows you to simulate the behavior of functions, modules, or APIs. This is particularly useful for testing isolated components.

Example:

const fetchData = jest.fn(() => Promise.resolve('data'));

test('fetches data', async () => {
  const data = await fetchData();
  expect(data).toBe('data');
  expect(fetchData).toHaveBeenCalledTimes(1);
});

3. Code Coverage

Run Jest with the --coverage flag to generate a code coverage report:

npx jest --coverage

This report shows which lines of code were executed during testing, helping you identify untested parts of your application.

Tips for Effective Jest Testing

  1. Write Testable Code: Structure your code to make it modular and easy to test.
  2. Use Descriptive Test Names: Clearly indicate the purpose of each test.
  3. Keep Tests Isolated: Avoid dependencies between tests to ensure accurate results.
  4. Leverage Jest Plugins: Explore plugins like jest-extended for additional matchers and utilities.
  5. Run Tests Frequently: Integrate Jest into your CI/CD pipeline to catch issues early.

Conclusion

Jest testing is an essential skill for any JavaScript developer looking to build reliable and maintainable applications. With its comprehensive features, ease of use, and strong community support, Jest provides everything you need to ensure your code works as intended. Start integrating Jest into your projects today and experience the benefits of automated testing firsthand!


Keywords: Jest testing, JavaScript testing framework, Jest tutorial, automated testing, React testing, snapshot testing, code coverage, mocking in Jest, JavaScript testing tools.

Published by
January 22, 2025 10:54 pm

Comments are closed here.


Creative

I studied Digital Media for 12 months at Mt Druitt TAFE. While  doing so we studied The 3D Modeling Program ‘Maya’. During the course I produced a number of 3D scenes and a couple of 3D animated movies.

I have also played in other programs such as Bryce 3D, 3D Studio Max, Lightwave, Vue D’esprit and a few others. However, i have always returned to Maya as a personal preference.

Bellow are a number of works that i have produced from these various programs.

Bryce 3D: Balls

Vue D’esprit: Sulfuric

Maya: Living Room

Maya: Gauntlet

Loading...