Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

jest

const sum = require('./sum');

test('adds 1 + 2 to equal 3', () => {
  expect(sum(1, 2)).toBe(3);
});
Copy
Comment

jest

beforeAll(() => console.log('1 - beforeAll'));
afterAll(() => console.log('1 - afterAll'));
beforeEach(() => console.log('1 - beforeEach'));
afterEach(() => console.log('1 - afterEach'));
test('', () => console.log('1 - test'));
describe('Scoped / Nested block', () => {
  beforeAll(() => console.log('2 - beforeAll'));
  afterAll(() => console.log('2 - afterAll'));
  beforeEach(() => console.log('2 - beforeEach'));
  afterEach(() => console.log('2 - afterEach'));
  test('', () => console.log('2 - test'));
});

// 1 - beforeAll
// 1 - beforeEach
// 1 - test
// 1 - afterEach
// 2 - beforeAll
// 1 - beforeEach
// 2 - beforeEach
// 2 - test
// 2 - afterEach
// 1 - afterEach
// 2 - afterAll
// 1 - afterAll
Copy
Comment

jest

function sum(a, b) {
  return a + b;
}
module.exports = sum;
Copied
Comment

jest

yarn add --dev jest
Comment

PREVIOUS NEXT
Code Example
Shell :: expo upgrade reset 
Shell :: wget as file name 
Shell :: linux screen run jar 
Shell :: The terminal process failed to launch: Path to shell executable "/bin/zsh" does not exist. 
Shell :: find location for powershell profile ps1 file 
Shell :: find java home 
Shell :: Connecting to WSL2 server via local network 
Shell :: how to run explorer in wsl 
Shell :: vim move line down 
Shell :: enable proxy in cmd 
Shell :: increment variable bash 
Shell :: tmu rename tab 
Shell :: bash temporary file 
Shell :: extract rpm in linux 
Shell :: rename a git repositor while cloning 
Shell :: how to rename folder in cmd 
Shell :: powershell make file 
Shell :: show hidden files linux 
Shell :: install pip dockerfile 
Shell :: install oh my zsh 
Shell :: ubuntu not showing currently open application icons 
Shell :: downgrade cocoapods in mac m1 
Shell :: bash remove trailing slash 
Shell :: bash redirect all output 
Shell :: top git commands 
Shell :: installing react router dom with yarn 
Shell :: see file size linux 
Shell :: adding remote origin git 
Shell :: get vscode extensions with powershell script 
Shell :: install sail into existing laravel 8 project 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =