Do you use Jest and React Testing Library for automated tests on your react-admin app? - unit-testing

Do you use:
Jest
React Testing Library
I'm having a hard time figuring out what to test and how to test it. react-admin has so much based in redux and contexts that it's hard to mock those things so you're focusing on just a single component instead of testing react-admin itself.

Related

Do I need a unit-testing framework if I'm already using Cypress in a Vue.js app?

When scaffolding a new project with the Vue.js CLI, it offers a choice of both unit-testing and E2E-testing frameworks.
Unit-testing functionality is perfectly adequate in Cypress. My question, then: is there an advantage to using a distinct unit-testing framework if I'm already using Cypress?
There is a third-party adapter made by a Cypress contributor here called cypress-vue-unit-test(along with unit-test adapters for other popular frameworks).
You should check that out and see if it meets your needs over, say, Jest
From this tutorial about unit testing vuejs, some Jest advantages over Cypress are:
Built in code coverage
Snapshot testing
Module mocking utilities
Also see repo for vue-test-utils

Configure mocha-teamcity-reporter with Web Component Tester

I want my Web Component Tester (WCT) tests to be reported to TeamCity-CI. As WCT uses mocha as testing framework, I figure it makes sense to use the mocha-teamcity-reporter.
The problem is; how can I configure Mocha/WCT with an extra reporter?

What is the bare minimum installation suite for unit testing in AngularJS?

I'm attempting to learn AngularJS. One of the things that attracts me is its claim of separation of concerns and unit testability. So it defeats me completely to understand why I should need to install Node.js, or any web server, to test (say) an AngularJS controller which does no DOM manipulation or call out to any web services.
Can anyone give me a definitive bare-minimum list of what is required to unit test AngularJS code?
I'm going assume that you understand the difference between end-to-end testing and unit testing in Angular, so you're only asking about what it takes to do unit testing, right?
Basically you're going to need pretty much everything that comes with the seed project. The seed project uses Karma as the test runner to execute the javascript that you've written. Step 02 of the AngularJS Tutorial (found here) walks through writing some simple tests and executing them using Karma. Everything required to do that comes with the seed-project.
Those required things are:
An angularjs app
Node.js (installed)
Karma
Some jasmine-style unit tests
If you don't want to use the seed project, you can use Step 02 of the tutorial as a spring board and just follow the Karma docs to download and install Karma and get it running.
I hope that helps.

How to test the upper layers of a ZF application

How do you test the controller and views in a Zend Framework application?
I have been using PHPUnit to test the mapper, domain and services, and that's been working fine. I use dependency injection so that I can isolate the class under test.
When it comes to the controller however I would probably not try to isolate it. I would effectively be doing integration tests at this point, but I think that's fine. I would still use PHPUnit and fire off requests for most tests.
For the views, I am thinking of using the CSS selectors in Zend_Test, but since I have a lot of Javascript I will have to use selenium too.
Does this all sound reasonable? What do you do?

unit testing sync framework

We have built a custom provider for the microsoft sync framework. How would you go about unit testing it or would you not bother with the unit testing and focus on integration tests?
I have had some success using Moq to help write unit tests for a custom provider. Unfortunately the Sync Framework hasn't been designed to make testing easy.