Sample Unit Test

PHOTO EMBED

Sat May 08 2021 17:59:57 GMT+0000 (Coordinated Universal Time)

Saved by @shubham75089 #jest #nodejs #testing

const {getIntroduction} = require('./util')

test('should output name and age', () => {
  const text = getIntroduction('Max', 20)
  expect(text).toBe('Max is 20 years old')
})
content_copyCOPY

Imports a function from a file and runs jest test on it