Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. // ##################################################################
  2. // # Do NOT edit any of the lines before the "// StartStudentCode" #
  3. // # line or after the "// EndStudentCode line. Do not remove those #
  4. // # two lines. #
  5. // # #
  6. // # If you do edit any of the other code, your submission will #
  7. // # probably not work. #
  8. // ##################################################################
  9.  
  10. // StartStudentCode
  11. var Automobile = function(make, model, wheels) {
  12. this.make = make;
  13. this.model = model;
  14. this.wheels = wheels;
  15.  
  16. Automobile.prototype.summary = function(){
  17. return this.make + '' + this.model + '' + (this.wheels + '' + ' wheels');
  18. }
  19. }
  20. // EndStudentCode
  21.  
  22. var assert = require('assert');
  23. describe('Question 2', function() {
  24. it('test', function() {
  25. var bmw = new Automobile('BMW', 'Z2', 4);
  26. assert.equal(bmw.make, 'BMW');
  27. assert.equal(bmw.model, 'Z2');
  28. assert.equal(bmw.wheels, 4);
  29. assert.equal(bmw.summary(), 'BMW Z2 (4 wheels)');
  30. var ktm = new Automobile('KTM', '1050 Adventure', 2);
  31. assert.equal(ktm.make, 'KTM');
  32. assert.equal(ktm.model, '1050 Adventure');
  33. assert.equal(ktm.wheels, 2);
  34. assert.equal(ktm.summary(), 'KTM 1050 Adventure (2 wheels)');
  35. });
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement