Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const FilmStudio = require('./filmStudio.js');
- const expect = require('chai').expect;
- describe("Tests …", function () {
- let fs;
- beforeEach(() => {
- fs = new FilmStudio('name');
- })
- describe("cotr", function () {
- it("should return name", function () {
- const expectedName = 'name';
- const actualName = fs.name;
- const expected = 0;
- const actual = fs.films.length;
- expect(expectedName).to.equal(actualName);
- expect(expected).to.equal(actual);
- });
- // it("should return empty array", function () {
- // const expected = 0;
- // const actual = fs.films.length;
- // expect(expected).to.equal(actual);
- // });
- });
- describe("casting", function () {
- it("should return no films", function () {
- const actual = `There are no films yet in ${fs.name}.`;
- const expected = fs.casting('A', 'B');
- expect(expected).to.equal(actual);
- });
- it("should return no roles for actor", function () {
- fs.makeMovie('The Avengers', ['Iron-Man', 'Thor', 'Hulk', 'Arrow guy']);
- const actor = 'A';
- const role = 'B';
- const actual = `${actor}, we cannot find a ${role} role...`;
- const expected = fs.casting('A', 'B');
- expect(expected).to.equal(actual);
- });
- it("should return actor got the job", function () {
- fs.makeMovie('The Avengers', ['Iron-Man', 'Thor', 'Hulk', 'Arrow guy']);
- const actual = 'You got the job! Mr. A you are next Iron-Man in the The Avengers. Congratz!';
- const expected = fs.casting('A', 'Iron-Man');
- expect(expected).to.equal(actual);
- });
- });
- describe("makeMovie", function () {
- it("should return film", function () {
- const expected = {
- filmName: 'The Avengers',
- filmRoles: [
- { role: 'Iron-Man', actor: false },
- { role: 'Thor', actor: false },
- { role: 'Hulk', actor: false },
- { role: 'Arrow guy', actor: false }]
- };
- const actual = fs.makeMovie('The Avengers', ['Iron-Man', 'Thor', 'Hulk', 'Arrow guy']);
- expect(expected).to.deep.equal(actual);
- });
- it("should return error msg: invalid arguments", function () {
- expect(() => fs.makeMovie('The Avengers', 1)).to.throw("Invalid arguments");
- });
- it("should return error msg: invalid arguments count", function () {
- expect(() => fs.makeMovie('The Avengers', 1, 'book')).to.throw("Invalid arguments count");
- });
- });
- describe("lookForProducer", function () {
- it("should return toString", function () {
- fs.makeMovie('The Avengers', ['Iron-Man', 'Thor']);
- fs.casting('Johnny Depp', 'Iron-Man');
- fs.casting('Kit Harington', 'Thor');
- let expected = 'Film name: The Avengers\n';
- expected += 'Cast:\n';
- expected += 'Johnny Depp as Iron-Man\n';
- expected += 'Kit Harington as Thor\n';
- const actual = fs.lookForProducer('The Avengers');
- expect(expected).to.deep.equal(actual);
- });
- it("should return error msg: invalid arguments", function () {
- expect(() => fs.lookForProducer('The')).to.throw(`The do not exist yet, but we need the money...`);
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement