Created
September 23, 2024 17:28
-
-
Save teasmade/1c2f720c5594b08c27700cbfcf1fb5f0 to your computer and use it in GitHub Desktop.
WCS TS-POO Q2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import assert from 'assert'; | |
class BankCustomer { | |
private name: string; | |
private pin: string; | |
constructor(name: string, pin: string) { | |
this.name = name; | |
this.pin = pin; | |
} | |
getName() { | |
return this.name; | |
} | |
verifyPinInput(pinInput: string) { | |
return this.pin === pinInput; | |
} | |
} | |
// Tests | |
const customer = new BankCustomer('John Doe', '3579'); | |
assert.equal(typeof customer.getName, 'function'); | |
assert.equal(typeof customer.verifyPinInput, 'function'); | |
assert.equal(customer.getName(), 'John Doe'); | |
assert.ok(customer.verifyPinInput('3579')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment