Skip to content

Instantly share code, notes, and snippets.

@teasmade
Created September 23, 2024 17:28
Show Gist options
  • Save teasmade/1c2f720c5594b08c27700cbfcf1fb5f0 to your computer and use it in GitHub Desktop.
Save teasmade/1c2f720c5594b08c27700cbfcf1fb5f0 to your computer and use it in GitHub Desktop.
WCS TS-POO Q2
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