Guest User

Untitled

a guest
Jan 19th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. class Counter
  2. count: 0
  3.  
  4. constructor: ->
  5. @count = 0
  6.  
  7. increment: ->
  8. @count++
  9.  
  10. decrement: ->
  11. @count--
  12.  
  13. reset: ->
  14. @count = 0
  15.  
  16. root = exports ? this
  17. root.Counter = Counter
  18.  
  19. describe("Counter", ->
  20. counter = new Counter
  21. it("shold have 0 as a count variable at first", ->
  22. expect(counter.count).toBe(0)
  23. )
  24.  
  25. describe('increment()', ->
  26. it("should count up from 0 to 1", ->
  27. expect(counter.increment()).toBe(1)
  28. )
  29. )
  30. )
  31.  
  32. class Counter
  33. count: 0
  34.  
  35. constructor: ->
  36. @count = 0
  37.  
  38. increment: ->
  39. ++@count
  40.  
  41. decrement: ->
  42. --@count
  43.  
  44. reset: ->
  45. @count = 0
  46.  
  47. root = exports ? this
  48. root.Counter = Counter
  49.  
  50. class Counter
  51. count: 0
  52.  
  53. constructor: ->
  54. @count = 0
  55.  
  56. increment: ->
  57. @count++
  58. @count
  59.  
  60. decrement: ->
  61. @count--
  62. @count
  63. reset: ->
  64. @count = 0
  65.  
  66. root = exports ? this
  67. root.Counter = Counter
  68.  
  69. describe('increment()', ->
  70. it("should count up from 0 to 1", ->
  71. expect(counter.count).toBe(0)
  72. counter.increment()
  73. expect(counter.count).toBe(1)
  74. )
  75. )
Add Comment
Please, Sign In to add comment