GithubHelp home page GithubHelp logo

nknapp / frontend-testing Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 235 KB

Demo repository for my talk at IT-Tage 23

JavaScript 1.31% Shell 0.11% HTML 0.77% Vue 10.47% TypeScript 63.89% CSS 23.45%

frontend-testing's Introduction

Demo project for my frontend testing talk

For some reason, we still don't like writing test for web-frontends. Most backend developers do it, frontend devs often don't. And if they do, they get frustrated. But what can we do?

This repo contains the demo application for my talk about frontend testing, with examples that I use in the talk. You can have a look and try out things with this repo.

It is not intended to be a fully tested, working and deployable apps. It is an example for project setup and unit testing. Please do not copy & paste without thinking. Use this as inspiration only.

Mock-Service-Worker

This was not part of the talk. In order to simplify the use of mock-apis, we write a small wrapper around mswjs.io.

  • In setup.ts, the file mock-api.test-helper.ts is included, which initializes a default mock api
  • Default mocks for all endpoint should be provided in the setup function
  • The function useRequestHandlers can be used to override the default request handlers for specific test cases.
  • src/test-utils/mock-requestHandlers contains the factory functions for request-handlers, simplifying the override in test-cases. Maybe it would be better to move it so src/backend.
  • The mock-api.test-helper module also collects sent requests and exports the function getSentRequests so that api-calls can be verified in the test. This is a very basic facility, which could be improved, but for this repo, I wanted to keep it simple.

Other References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.