Coder Social home page Coder Social logo

Unit test environment setup about undebate HOT 4 CLOSED

ddfridley avatar ddfridley commented on June 12, 2024
Unit test environment setup

from undebate.

Comments (4)

djbowers avatar djbowers commented on June 12, 2024

So I have been doing some research into the different testing frameworks that are out there, and it seems like the two mains ones for testing React apps are Jest and Mocha.

After going through some tutorials for each, I can safely say that they both would work fine for us. There is some more setup required to get Mocha working, as well as a few additional libraries that are required such as Chai and Sinon in order to get assertions and mocks/stubs/spies that Jest comes with by default.

Also Jest comes with snapshot functionality baked in, which could be a great way to test individual React components.

I would say in general, unless we have a specific reason to need the additional customization that is required by Mocha, we would be safe to stick with Jest.

from undebate.

pewkers avatar pewkers commented on June 12, 2024

I have used JEST. It works well, it's well documented, and it is easy to use. The only downside that I can think of is it gets a bit tedious in certain parts.

from undebate.

ddfridley avatar ddfridley commented on June 12, 2024

Ok - so Jest it is. I like it because there is support for using it with Storybook - https://storybook.js.org/docs/testing/automated-visual-testing/

I can see that we are going to have to end up with a range of test environments, low lever unit tests for .js code, visual tests (woes it look right when its rendered), interactive tests (if video data stalls, does the stall window pop up and show something), and end to end tests (cypress).

from undebate.

ddfridley avatar ddfridley commented on June 12, 2024

@djbowers I looked through the code and couldn't find another example of something JS that didn't interact with anything else. We either have to build tests of things that use the db, or test things that render. app/components/preamble.jsx seems to be about the simplest thing that renders.

In this repo: https://github.com/EnCiv/iota I have taken the Iota model and made a separate repo out of it, so it can be included in multiple projects. In this repo there is test.js that starts up a local mongo db, and then tests it. You could jestify this repo, and I could migrate toward using it in undebate. But also, this could be the basis for how to create tests of things that use the mongodb, like the APIs in app/apis.

from undebate.

Related Issues (20)

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.