SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe("class FilmStudio", () => {
  2.  
  3.     it("checking name of instance", () => {
  4.         let studio = new FilmStudio('Su-Studio');
  5.         expect(studio.name).to.equal('Su-Studio');
  6.     });
  7.  
  8.     it("checking is new instance have a property 'films' - empty array", () => {
  9.         let studio = new FilmStudio('Su-Studio');
  10.         expect(Array.isArray(studio.films)).equal(true);
  11.         expect(studio.films.length).equal(0);
  12.     });
  13.  
  14.     it("checking a function makeMovie() for throws", () => {
  15.         let studio = new FilmStudio('Su-Studio');
  16.         expect(() => studio.makeMovie('Titanik')).to.throw('Invalid arguments count');
  17.         expect(() => studio.makeMovie(['firstRole', 'secondRole'])).to.throw('Invalid arguments count');
  18.         expect(() => studio.makeMovie(123, ['firstRole', 'secondRole'])).to.throw('Invalid arguments');
  19.         expect(() => studio.makeMovie('Titanik', 'firstRole, secondRole')).to.throw('Invalid arguments');
  20.     });
  21.  
  22.     it("checking my first movie with correct arguments past to function makeMovie()", () => {
  23.         let studio = new FilmStudio('Su-Studio');
  24.         let firstMovie = studio.makeMovie('Andromeda', ['Role1', 'Role2']);
  25.         expect(JSON.stringify(firstMovie)).to.equal('{"filmName":"Andromeda","filmRoles":[{"role":"Role1","actor":false},{"role":"Role2","actor":false}]}');
  26.     });
  27.  
  28.     it("checking my second movie, which is with the same name like my first", () => {
  29.         let studio = new FilmStudio('Su-Studio');
  30.         studio.makeMovie('Andromeda', ['Role1', 'Role2']);
  31.         let secondMovie = studio.makeMovie('Andromeda', ['Role2', 'Role3']);
  32.         expect(JSON.stringify(secondMovie)).to.equal('{"filmName":"Andromeda 2","filmRoles":[{"role":"Role2","actor":false},{"role":"Role3","actor":false}]}');
  33.     });
  34.  
  35.     it("checking my third movie, which is with the same name like my first and second", () => {
  36.         let studio = new FilmStudio('Su-Studio');
  37.         studio.makeMovie('Andromeda', ['Role1', 'Role2']);
  38.         studio.makeMovie('Andromeda', ['Role2', 'Role3']);
  39.         let thirdMovie = studio.makeMovie('Andromeda', ['Role2', 'Role3']);
  40.         expect(thirdMovie).deep.equal({
  41.             filmName: 'Andromeda 3',
  42.             filmRoles: [{ role: 'Role2', actor: false }, { role: 'Role3', actor: false }]
  43.         });
  44.     });
  45.  
  46.     it("checking a function casting(), if we have not any films yet", () => {
  47.         let studio = new FilmStudio('Su-Studio');
  48.         expect(studio.casting('actorName', 'role')).to.equal(`There are no films yet in Su-Studio.`);
  49.     });
  50.  
  51.     it("checking a function casting() with existing film, but not existing role in it", () => {
  52.         let studio = new FilmStudio('Su-Studio');
  53.         studio.makeMovie('Anakonda', ['Role1', 'Role2']);
  54.         expect(studio.casting('actorName', 'Role3')).to.equal(`actorName, we cannot find a Role3 role...`);
  55.     });
  56.  
  57.     it("checking a function casting(), with existing film and role", () => {
  58.         let studio = new FilmStudio('Su-Studio');
  59.         studio.makeMovie('Andromeda', ['Role1', 'Role2']);
  60.         let result = studio.casting('actorName', 'Role2');
  61.         expect(result).equal(`You got the job! Mr. actorName you are next Role2 in the Andromeda. Congratz!`);
  62.         expect(studio.films[0].filmRoles[1].actor).equal('actorName')
  63.     });
  64.  
  65.     it("checking a function lookForProducer(filmName), with non existing movie", () => {
  66.         let studio = new FilmStudio('Su-Studio');
  67.         studio.makeMovie('Andromeda', ['Role1', 'Role2']);
  68.         expect(() => studio.lookForProducer('Titanik')).to.throw(`Titanik do not exist yet, but we need the money...`);
  69.     });
  70.  
  71.     it("checking a function lookForProducer(filmName)", () => {
  72.         let studio = new FilmStudio('Su-Studio');
  73.         studio.makeMovie('Andromeda', ['Role1', 'Role2']);
  74.         studio.casting('actorName1', 'Role1');
  75.         studio.casting('actorName2', 'Role2');
  76.         let result = studio.lookForProducer('Andromeda')
  77.         expect(JSON.stringify(result))
  78.             .equal('"Film name: Andromeda\\nCast:\\nactorName1 as Role1\\nactorName2 as Role2\\n"');
  79.     });
  80.  
  81. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top