-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blé Mardel Airport Challenge #196
base: main
Are you sure you want to change the base?
Conversation
class Instruction { | ||
|
||
} | ||
export default Instruction; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What went well:
- I think that I have done a good job of following TDD principles, by first writing failing tests, then writing production code to pass the tests.
- With the use of the Instruction class, I was able to loosely couple my code and maintain high cohesiveness. This was done by using the instruction class that took in an airport, and plane object...and only having the relevant methods written in the relevant classes. For example, the instruction class simply calls on the airport's
landPlane()
method. It doesn't handle the landing of the planes itself.
expect(() => { testInstruction.landPlane() }).toThrowError('Too stormy to land / take-off'); | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What went well:
- With the use of Jasmine as my testing framework, I was able to advance from simple assertion tests. I was also able to test whether the correct methods were called, and also test my error-handling procedures.
this.#airport.landPlane(this.#plane); | ||
} | ||
|
||
takeOffPlane() { | ||
if (this.#plane.isLanded() === false) { | ||
throw this.#takeOffError; | ||
} | ||
if (this.#airport.checkWeather() === 'stormy') { | ||
throw this.#weatherError; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even Better If:
- I could have used a method to handle the logic of checking for errors, instead of having them within the methods that should only be doing one thing e.g. landing or take-off a plane. This would make my code look cleaner, and it would be easier to maintain.
No description provided.