Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import assert from 'assert';
  2.  
  3.  
  4.  
  5. // ... Ton code ici ...
  6. class BankCustomer {
  7.  
  8. private _name: string;
  9. private _code: number;
  10.  
  11. constructor(name: string, code: number) {
  12.  
  13. this._name = name;
  14. this._code = code;
  15. }
  16.  
  17.  
  18. getName(): string {
  19.  
  20. return this._name;
  21. }
  22.  
  23.  
  24. verifyPinInput(newCode): boolean {
  25.  
  26. if (newCode === this._code) {
  27. return newCode = true;
  28. } else {
  29. return newCode = false;
  30. }
  31.  
  32. }
  33.  
  34.  
  35.  
  36. // Tests
  37.  
  38. const customer = new BankCustomer('John Doe', '3579');
  39. assert.equal(typeof customer.getName, 'function');
  40. assert.equal(typeof customer.verifyPinInput, 'function');
  41. assert.equal(customer.getName(), 'John Doe');
  42. assert.ok(customer.verifyPinInput('3579'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement