Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe("Trip tests", () => {
- it("choosingDestination", () => {
- expect(() => {
- planYourTrip.choosingDestination("Ski Resort", "Winter", 2023);
- }).to.throw("Invalid Year!");
- expect(() => {
- planYourTrip.choosingDestination("Ski Resort", "Winter", null);
- }).to.throw("Invalid Year!");
- expect(() => {
- planYourTrip.choosingDestination("Ski Resort", "Winter", undefined);
- }).to.throw("Invalid Year!");
- expect(() => {
- planYourTrip.choosingDestination("Ski Resort", "Winter", "ham");
- }).to.throw("Invalid Year!");
- expect(() => {
- planYourTrip.choosingDestination("Paris", "Winter", 2024);
- }).to.throw("This destination is not what you are looking for.");
- expect(() => {
- planYourTrip.choosingDestination(20, "Winter", 2024);
- }).to.throw("This destination is not what you are looking for.");
- expect(
- planYourTrip.choosingDestination("Ski Resort", "Spring", 2024)
- ).to.equal(
- "Consider visiting during the Winter for the best experience at the Ski Resort."
- );
- expect(
- planYourTrip.choosingDestination("Ski Resort", "Winter", 2024)
- ).to.equal(
- "Great choice! The Winter is the perfect time to visit the Ski Resort."
- );
- });
- it("exploreOptions", () => {
- expect(() => {
- planYourTrip.exploreOptions("Skiing", 0);
- }).to.throw("Invalid Information!");
- expect(() => {
- planYourTrip.exploreOptions(["Skiing"], "a");
- }).to.throw("Invalid Information!");
- expect(() => {
- planYourTrip.exploreOptions(["Skiing"], 1);
- }).to.throw("Invalid Information!");
- expect(() => {
- planYourTrip.exploreOptions(["Skiing"], 1.1);
- }).to.throw("Invalid Information!");
- expect(() => {
- planYourTrip.exploreOptions(["Skiing"], -1);
- }).to.throw("Invalid Information!");
- expect(planYourTrip.exploreOptions(["Skiing"], 0)).to.equal("");
- expect(planYourTrip.exploreOptions(["Skiing", "Kissing"], 0)).to.equal(
- "Kissing"
- );
- });
- it("estimateExpenses", () => {
- expect(() => {
- planYourTrip.estimateExpenses("1", "1");
- }).to.throw("Invalid Information!");
- expect(() => {
- planYourTrip.estimateExpenses(1, "1");
- }).to.throw("Invalid Information!");
- expect(() => {
- planYourTrip.estimateExpenses("1", 1);
- }).to.throw("Invalid Information!");
- expect(() => {
- planYourTrip.estimateExpenses(1, 0);
- }).to.throw("Invalid Information!");
- expect(() => {
- planYourTrip.estimateExpenses(1, -1);
- }).to.throw("Invalid Information!");
- expect(planYourTrip.estimateExpenses(100, 1.2)).to.equal(
- "The trip is budget-friendly, estimated cost is $120.00."
- );
- expect(planYourTrip.estimateExpenses(100, 5)).to.equal(
- "The trip is budget-friendly, estimated cost is $500.00."
- );
- expect(planYourTrip.estimateExpenses(100, 7)).to.equal(
- "The estimated cost for the trip is $700.00, plan accordingly."
- );
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment