Created
October 12, 2024 08:17
-
-
Save simbld/ddec6b7eb02aae35ef0f64f7918c7f2b to your computer and use it in GitHub Desktop.
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 { | |
constructor(name, pin) { | |
this.name = name; | |
this.pin = pin; | |
} | |
getName() { | |
return this.name; | |
} | |
verifyPinInput(input) { | |
return input === this.pin; | |
} | |
} | |
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)); | |
console.log('test passed'); |
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: number; | |
constructor(name: string, pin: number) { | |
this.name = name; | |
this.pin = pin; | |
} | |
getName(): string { | |
return this.name; | |
} | |
verifyPinInput(input: number): boolean { | |
return input === this.pin; | |
} | |
} | |
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)); |
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
> [email protected] start | |
> node dist/bankCustomer.js | |
test passed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment