T
T
Tshmt2020-11-20 00:30:28
JavaScript
Tshmt, 2020-11-20 00:30:28

What is jest test generator?

What are auto-generators of test templates based on ready-made classes?
For example, I have a class and it has a bunch of methods.

class Base {
    sum(a, b) {
        return a + b
    }
    showName() {
        return 'John Doe'
    }
}
module.exports = Base

and you need to generate a template for testing the class in this form:
const Base = require('./Base')

describe('Base class', () => {

    it('test sum function', () => {

    })
    it('test showName function', () => {

    })
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2020-11-20
@vabka

I think no.
Quite a strange case. I always wrote tests by hand (not in js).
The case seems strange, since in general you will have to write several tests per method.
But if you really want to automate at least something - look at Property based testing

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question