Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { totalWeight, getTotalSum, namesCount } from '../total-weight'
  2. import list from '../../stub/services/list-1.json'
  3.  
  4. describe('totalWeight', () => {
  5.     it('No items - weight zero', () => {
  6.         expect(totalWeight([])).toBe(0)
  7.     })
  8.  
  9.     it('calculates total weight', () => {
  10.         expect(totalWeight(list)).toBe(850)
  11.     })
  12. })
  13.  
  14. describe('getTotalSum', () => {
  15.     it('No items - sum 0', () => {
  16.         expect(getTotalSum([])).toBe(0)
  17.     })
  18.  
  19.     it('calculates total sum', () => {
  20.         expect(getTotalSum(list)).toBe(1550)
  21.     })
  22. })
  23.  
  24. describe('namesCount', () => {
  25.     it('No items - 0 names', () => {
  26.         expect(namesCount([])).toBe(0)
  27.     })
  28.  
  29.     it('calucultes names count', () => {
  30.         expect(namesCount(list)).toBe(5)
  31.     })
  32. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement