SHARE
TWEET

Film Studio Unit Testing

MartinGeorgiev Apr 4th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe("Film Studio", function () {
  2.     let sampleInstance;
  3.     beforeEach(function () {
  4.         sampleInstance = new FilmStudio('Pesho');
  5.     });
  6.     it('testing constructor studioName property', function () {
  7.         expect(sampleInstance.name).to.deep.equal('Pesho');
  8.     });
  9.     it('testing constructor films property', function () {
  10.         expect(sampleInstance.films).to.deep.equal([]);
  11.     });
  12.  
  13.     it('testing makeMovie filmName', function () {
  14.  
  15.         let result = sampleInstance.makeMovie('The Avengers', ['Iron-Man', 'Thor', 'Hulk', 'Arrow guy']);
  16.        
  17.         expect(result.filmName).to.deep.equal(`The Avengers`);
  18.     });
  19.  
  20.     it('testing makeMovie roles', function () {
  21.  
  22.         let result = sampleInstance.makeMovie('The Avengers', ['Iron-Man', 'Thor', 'Hulk', 'Arrow guy']);
  23.         expect(result.filmRoles).to.deep.equal([ { role: 'Iron-Man', actor: false },        { role: 'Thor', actor: false },        { role: 'Hulk', actor: false },       { role: 'Arrow guy', actor: false } ]);
  24.     });
  25.  
  26.     it('testing makeMovie with few args', function () {
  27.  
  28.         expect(()=>sampleInstance.makeMovie( ['Iron-Man', 'Thor', 'Hulk', 'Arrow guy'])).to.throw('Invalid arguments count');
  29.     });
  30.  
  31.    
  32.     it('testing makeMovie with WRONG args', function () {
  33.  
  34.         expect(()=>sampleInstance.makeMovie(1, ['Iron-Man', 'Thor', 'Hulk', 'Arrow guy'])).to.throw('Invalid arguments');
  35.     });
  36.  
  37.     it('testing makeMovie with WRONG args', function () {
  38.         sampleInstance.makeMovie('The Avengers', ['Iron-Man', 'Thor', 'Hulk', 'Arrow guy']);
  39.         expect(()=>sampleInstance.lookForProducer('Gosho')).to.throw('Gosho do not exist yet, but we need the money...');
  40.     });
  41.  
  42.    
  43.     it('testing makeMovie with RIGHT args', function () {
  44.         sampleInstance.makeMovie('The Avengers', ['Iron-Man']);
  45.         result = sampleInstance.lookForProducer('The Avengers')
  46.         expect(result).to.deep.equal(`Film name: The Avengers\nCast:\nfalse as Iron-Man\n`);
  47.     });
  48.  
  49.     it('testing makeMovie with RIGHT casting', function () {
  50.         sampleInstance.makeMovie('The Avengers', ['Iron-Man']);
  51.         result = sampleInstance.casting('Pesho','Iron-Man')
  52.         expect(result).to.deep.equal(`You got the job! Mr. Pesho you are next Iron-Man in the The Avengers. Congratz!`);
  53.     });
  54.  
  55.    
  56.     it('testing makeMovie with RIGHT casting', function () {
  57.         sampleInstance.makeMovie('The Avengers', ['Iron-Man']);
  58.         result = sampleInstance.casting('Pesho','WRONG')
  59.         expect(result).to.deep.equal(`Pesho, we cannot find a WRONG role...`);
  60.     });
  61.  
  62.     it('testing makeMovie with RIGHT casting', function () {
  63.         result = sampleInstance.casting('Pesho','WRONG')
  64.         expect(result).to.deep.equal(`There are no films yet in Pesho.`);
  65.     });
  66.  
  67.  
  68.     it('testing makeMovie with RIGHT casting', function () {
  69.         sampleInstance.makeMovie('The Avengers', ['Iron-Man']);
  70.         sampleInstance.makeMovie('Hulk', ['Iron-Man']);
  71.         result = sampleInstance.casting('Pesho','Iron-Man')
  72.         expect(result).to.deep.equal(`You got the job! Mr. Pesho you are next Iron-Man in the The Avengers. Congratz!`);
  73.     });
  74.  
  75.  
  76. })
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