GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dusty-learning/learnyoutesting: Javascript unit testing

This repository was archived by the owner on Feb 10, 2023. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

41 Commits
41 Commits

Folders and files

NameName
Last commit message
Last commit date
activity
activity
 
 
examples
examples
 
 
tap
tap
 
 
tape
tape
 
 
testing-suites
testing-suites
 
 
what-is-a-unit-test
what-is-a-unit-test
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

Unit Testing

Unit testing in the world of javascript

Core Concept

Unit testings main purpose is to do one thing, test the code you write

Not Testing in the Browser

No testing it in the browser does't count. The purpose of testing is so later on say you want to add/edit a feature, you don't have to worry about what will break. Your tests will verify that all of your functionality is still intact.

It's a good idea to build out your testing setup and environment as you write your code to keeps things on a 1 to 1 basis. This also helps with groups working on the same codebase, if one of your team adds in new code, and it breaks a unit test well I suggest that code doesn't go any further.

This is also the easiest approach it makes sure your code is indeed testable, and stays that way as you advence and your app becomes larger and more complex.

You want to make sure you ALWAYS test all of your code as much as possible and from as many different use cases that you can think of.

Try to test only your code

If you're using external libraries like a JavaScript framework, or utility library like underscore since these are usually already well tested, if not then I may start to question your judgement.

Contents

  • What is a Unit Test?
  • Testing Suites
  • What is a Tap?
  • How to Use Tape

How To

  • Clone the repo
  • Open repo and run npm i
  • Run one of the following commands:
    • npm run test:01 - Run the simple tests
    • npm run test:02-user - Run the user tests
    • npm run test:02-weather - Run the weather tests
    • npm run test:03 - Run the example 3 tests
    • npm run test:04 - Run the example 4 tests
    • npm run test:04:tapspec - Run the example 4 tests with the tap-spec formatting
    • npm run test:activity - Run the activity tests (Uses tap-spec formatting)
    • npm run test:mocha - Run the mocha example activity
    • npm run test:titleize - Run the titleize SOLVED unit tests
    • npm run test:disemvowel - Run the disemvowel SOLVED unit tests
    • npm run test:tax - Run the tax SOLVED unit tests
    • npm test - Runs all of the example tests

About

Javascript unit testing

Resources

Readme
Activity
Custom properties

Stars

6 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.