Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe("Tests weddingDay", () => {
- describe("Tests pickVenue", () => {
- it("Test for empty string", () => {
- expect(() => {weddingDay.pickVenue(1, 2, "")}).to.throw(
- "Invalid Information!"
- );
- });
- it("Test for incorrect capacity, pricePerGuest and string", () => {
- expect(() => {weddingDay.pickVenue("1", 2, "")}).to.throw(
- "Invalid Information!"
- );
- });
- it("Test for incorrect capacity, pricePerGuest and string", () => {
- expect(() => {weddingDay.pickVenue(1, "2", "")}).to.throw(
- "Invalid Information!"
- );
- });
- it("Test for incorrect capacity, pricePerGuest and string", () => {
- expect(() => {weddingDay.pickVenue(1, "2", "[]")}).to.throw(
- "Invalid Information!"
- );
- });
- it("Test for incorrect location", () => {
- expect(() => {weddingDay.pickVenue(1, 2, "Bourgas")}).to.throw(
- "The location of this venue is not in the correct area!"
- );
- });
- it("Place selection test with min and max boudary", () => {
- expect(weddingDay.pickVenue(150, 120, "Varna")).to.equal(
- "This venue meets the requirements, with capacity of 150 guests and 120$ cover."
- );
- });
- it("Place selection test in boudary", () => {
- expect(weddingDay.pickVenue(151, 112, "Varna")).to.equal(
- "This venue meets the requirements, with capacity of 151 guests and 112$ cover."
- );
- });
- it("Place selection test out of boudary", () => {
- expect(weddingDay.pickVenue(149, 121, "Varna")).to.equal(
- "This venue does not meet your requirements!"
- );
- });
- });
- describe("Tests tableDistribution", () => {
- it("Test for guest and tables are not number or are a negative numbers", () => {
- expect(() => {weddingDay.tableDistribution("1", 1)}).to.throw(
- "Invalid Information!"
- );
- expect(() => {weddingDay.tableDistribution("1", "1")}).to.throw(
- "Invalid Information!"
- );
- expect(() => {weddingDay.tableDistribution(1, "1")}).to.throw(
- "Invalid Information!"
- );
- expect(() => {weddingDay.tableDistribution(1, [1])}).to.throw(
- "Invalid Information!"
- );
- });
- it("tests for less than 6 people on each table", () => {
- expect(weddingDay.tableDistribution(100, 20)).to.equal(
- "There is only 5 people on every table, you can join some tables."
- );
- });
- it("tests for greater than 6 people on each table", () => {
- expect(weddingDay.tableDistribution(100, 10)).to.equal(
- "You have 10 tables with 10 guests on table."
- );
- });
- });
- it('otherSpendings', () => {
- expect(() => weddingDay.otherSpendings({}, {}, {})).to.throw();
- expect(() => weddingDay.otherSpendings([], {}, {})).to.throw();
- expect(() => weddingDay.otherSpendings([], [], {})).to.throw();
- expect(() => weddingDay.otherSpendings('', [], true)).to.throw();
- expect(() => weddingDay.otherSpendings([], [], true)).to.not.throw();
- expect(weddingDay.otherSpendings(['flowers', 'Fabric drapes and curtains'], ['pictures', 'video'], false)).to.equal(
- 'You spend 2900$ for wedding decoration and photography!'
- );
- expect(weddingDay.otherSpendings(['flowers'], ['pictures'], false)).to.equal(
- 'You spend 1200$ for wedding decoration and photography!'
- );
- expect(weddingDay.otherSpendings(['Fabric drapes and curtains'], ['video'], false)).to.equal(
- 'You spend 1700$ for wedding decoration and photography!'
- );
- expect(weddingDay.otherSpendings(['flowers', 'Fabric drapes and curtains'], ['pictures', 'video'], true)).to.equal(
- 'You spend 2465$ for wedding decoration and photography with 15% discount!'
- );
- expect(weddingDay.otherSpendings(['flowers'], ['pictures'], true)).to.equal(
- 'You spend 1020$ for wedding decoration and photography with 15% discount!'
- );
- expect(weddingDay.otherSpendings(['Fabric drapes and curtains'], ['video'], true)).to.equal(
- 'You spend 1445$ for wedding decoration and photography with 15% discount!'
- );
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement