Questions tagged [Development through testing] (126)

1
answer

How to write a unit test for the function of reducer?

I'm new to unit testing. I have a problem, I need to write a test that would have tested reducer. I wrote something myself, but due to the fact that I am using localStorage in initialState, the test doesn't work for me. The error sounds like this: TypeError: localStorage.getItem is not a function. I ask you to help me write...
Marshall_Hermann asked April 9th 20 at 10:38
2
answers

How to change state a component of the parent Jest / Enzyme?

I have the main component of Todowhich has a state. In this state I keep todos and name, which is entered through input. I have a separate Input component, to which I just prokidyvaya props: <TodoInput onChange={this.handleInput} /> Tell me what from shallow TodoInput to change state (name) in the parent Todo to tes...
Stan.Aufderhar45 asked April 9th 20 at 09:38
0
answer
1
answer

Write class + test, I can not understand why everything is broken?

Hi guys, writing a class and want to test it. There is a class. From here have cleaned all superfluous, to understand the main meaning. from appmodule.database.db import connection class Task: @classmethod def delete(cls, task_id): try: cursor = connection.cursor() sql = 'DELETE FROM task WHERE task_id = 64' cursor.ex...
Jerad_Murph asked April 7th 20 at 10:38
0
answer

How to define alias path for jest-puppeteer?

When trying to run the tests, it complains it can't find files which let written through the alias. Example: import ROUTER_NAMES from "@/app/auth/core/router is const" Gives an error Cannot find module '@/app/auth/core/router const' from 'middleware-auth.js' In jest.config.js prescribed moduleNameMapper and it works for un...
darrel.Williamson asked April 7th 20 at 10:36
12
answers

Is it possible testing a site in unattended mode?

Is it possible testing a site in automatic mode on the algorithm: At a certain point you run the script, probably from a different server, which should do the following: - randomly go to different pages of the website, put in your shopping basket, fill in the checkout fields to send the order - complete and submit various f...
0
answer

“ReferenceError: document is not defined”?

Good day, started to deal with jsdom. Wrote a very simple function for clarity. I made a test using mocha, chai and JSDOM. All the document in my module commented out due to the fact that if I recommendyou, you will see the error "ReferenceError: document is not defined". In theory I understand what she means. This error m...
sid_Schaef asked April 4th 20 at 01:10
2
answers

Kubernetes how to start testing?

Good day! Imagine that there is a simple NodeJS app with MongoDB database, all works in containers and for example in the local cluster Minikube (classic tutorial when you search for "nodejs mongo kubernetes"). We also remember that we have a pyramid of tests: UI Integration Unit Questions: 1. [Unit] do I need to run the Un...
1
answer

How to test with Mocha changes in HTML?

Good afternoon, prompt please. I understand how to test with Mocha a javascript function which something returns, but how can I test functions that do some changes in the DOM tree. I can assume, based on the read information, you need to use JSDOM. I would be grateful for any more or less like a practical example or any inf...
Katelin86 asked April 4th 20 at 00:35
0
answer

Maybe someone knows a good course on TDD for the frontend?

Recently discovered A comprehensive step-by-step video course on designing robust Laravel applications with TDD test driven laravel this mega course closed almost all my questions on TDD. but only for the backend. Maybe someone knows of such a course on TDD for the frontend? Something like "A comprehensive step-by-step c...