From a6c150219e3dc43b91086b91fe8a46ff2f6109c2 Mon Sep 17 00:00:00 2001 From: sheriffderek Date: Fri, 9 Dec 2016 22:54:38 -0800 Subject: [PATCH 01/10] Clean up --- src/index.js | 13 +------------ src/spec.js | 1 - 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/index.js b/src/index.js index 5237ff4..a07ffec 100644 --- a/src/index.js +++ b/src/index.js @@ -4,23 +4,12 @@ export function double ( x ) { export function doubleXTimes ( x, num ) { let result = x; - for ( let i = 1; i <= num; i++ ) { - // result = result * 2; result = double( result ); } - return result; } export function doubleEach ( arr ) { - let result = arr.map( double ); - - // const result = arr.map( x => double( x ) ); - // const result = arr.map( function ( x ) { - // return double( x ); - // }); - - return result; + return arr.map( double ); } - diff --git a/src/spec.js b/src/spec.js index 3e22930..96cc039 100644 --- a/src/spec.js +++ b/src/spec.js @@ -27,4 +27,3 @@ test( 'doubleEach', function ( test ) { test.end(); }); - From 46235f35f870d64c370d79ac3bca6823aa60bd96 Mon Sep 17 00:00:00 2001 From: sheriffderek Date: Sat, 10 Dec 2016 00:11:28 -0800 Subject: [PATCH 02/10] first-tests --- src/index.js | 2 ++ src/spec.js | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index a07ffec..976b40a 100644 --- a/src/index.js +++ b/src/index.js @@ -13,3 +13,5 @@ export function doubleXTimes ( x, num ) { export function doubleEach ( arr ) { return arr.map( double ); } + +export function Animal() {}; diff --git a/src/spec.js b/src/spec.js index 96cc039..0f40d6d 100644 --- a/src/spec.js +++ b/src/spec.js @@ -1,5 +1,5 @@ import test from 'tape'; -import { double, doubleXTimes, doubleEach } from './index'; +import { double, doubleXTimes, doubleEach, Animal } from './index'; test( 'double fn', function ( test ) { const actual = double( 5 ); @@ -27,3 +27,10 @@ test( 'doubleEach', function ( test ) { test.end(); }); + +test('Animal exists', function(test) { + const animal = new Animal(); + + test.ok( animal instanceof Animal, 'should create an instance of Animal' ); + test.end(); +}); From 79270b892216795a436b5b687db6ff496b557570 Mon Sep 17 00:00:00 2001 From: sheriffderek Date: Sat, 10 Dec 2016 00:13:35 -0800 Subject: [PATCH 03/10] Adds speak method to Animal --- src/index.js | 4 ++++ src/spec.js | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 976b40a..6ddb06d 100644 --- a/src/index.js +++ b/src/index.js @@ -15,3 +15,7 @@ export function doubleEach ( arr ) { } export function Animal() {}; + +Animal.prototype.speak = function(sound) { + return sound; +} diff --git a/src/spec.js b/src/spec.js index 0f40d6d..d97d2d4 100644 --- a/src/spec.js +++ b/src/spec.js @@ -1,5 +1,5 @@ import test from 'tape'; -import { double, doubleXTimes, doubleEach, Animal } from './index'; +import { double, doubleXTimes, doubleEach, Animal, Reptile } from './index'; test( 'double fn', function ( test ) { const actual = double( 5 ); @@ -34,3 +34,12 @@ test('Animal exists', function(test) { test.ok( animal instanceof Animal, 'should create an instance of Animal' ); test.end(); }); + +test('Animal has speak method', function(test) { + const animal = new Animal(); + const expected = 'generic sound'; + const actual = animal.speak(expected); + + test.equal( actual, expected, 'should make a generic sound when it speaks' ); + test.end(); +}); From 53123f6cb0ebdb5ce61f4468b1a1ee79367bcb5a Mon Sep 17 00:00:00 2001 From: sheriffderek Date: Sat, 10 Dec 2016 00:44:50 -0800 Subject: [PATCH 04/10] Adds Reptile and Primate --- src/index.js | 8 ++++++++ src/spec.js | 26 +++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 6ddb06d..9aa2ebb 100644 --- a/src/index.js +++ b/src/index.js @@ -19,3 +19,11 @@ export function Animal() {}; Animal.prototype.speak = function(sound) { return sound; } + +export function Reptile() {}; + +Reptile.prototype = Object.create(Animal.prototype); + +export function Primate() {}; + +Primate.prototype = Object.create(Animal.prototype); diff --git a/src/spec.js b/src/spec.js index d97d2d4..55ac874 100644 --- a/src/spec.js +++ b/src/spec.js @@ -1,5 +1,5 @@ import test from 'tape'; -import { double, doubleXTimes, doubleEach, Animal, Reptile } from './index'; +import { double, doubleXTimes, doubleEach, Animal, Reptile, Primate } from './index'; test( 'double fn', function ( test ) { const actual = double( 5 ); @@ -43,3 +43,27 @@ test('Animal has speak method', function(test) { test.equal( actual, expected, 'should make a generic sound when it speaks' ); test.end(); }); + +test('Checks Animal inheritance', function(test) { + let actual, expected; + + const reptile = new Reptile(); + + test.ok( reptile instanceof Reptile, 'should be an instance of Reptile' ); + test.ok( reptile instanceof Animal, 'should be an instance of Animal' ); + + expected = Reptile.SOUND; + actual = reptile.speak(); + test.equal( actual, expected, 'should make a reptile sound when it speaks' ); + + const primate = new Primate(); + + test.ok( primate instanceof Primate, 'should be an instance of Primate' ); + test.ok( primate instanceof Animal, 'should be an instance of Animal' ); + + expected = Primate.SOUND; + actual = primate.speak(); + test.equal( actual, expected, 'should make a primate sound when it speaks' ); + + test.end(); +}); From a3bda501b227729510abea1667ee2dd0034eff2d Mon Sep 17 00:00:00 2001 From: sheriffderek Date: Sat, 10 Dec 2016 00:48:30 -0800 Subject: [PATCH 05/10] Adds human --- src/index.js | 4 ++++ src/spec.js | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 9aa2ebb..44d977f 100644 --- a/src/index.js +++ b/src/index.js @@ -27,3 +27,7 @@ Reptile.prototype = Object.create(Animal.prototype); export function Primate() {}; Primate.prototype = Object.create(Animal.prototype); + +export function Human() {}; + +Human.prototype = Object.create(Primate.prototype); diff --git a/src/spec.js b/src/spec.js index 55ac874..e079d9a 100644 --- a/src/spec.js +++ b/src/spec.js @@ -1,5 +1,5 @@ import test from 'tape'; -import { double, doubleXTimes, doubleEach, Animal, Reptile, Primate } from './index'; +import { double, doubleXTimes, doubleEach, Animal, Reptile, Primate, Human } from './index'; test( 'double fn', function ( test ) { const actual = double( 5 ); @@ -67,3 +67,20 @@ test('Checks Animal inheritance', function(test) { test.end(); }); + +test('Adds Human', function(test) { + let actual, expected; + + const human = new Human(); + + test.ok( human instanceof Human, 'should be an instance of Human' ); + test.ok( human instanceof Primate, 'should be an instance of Primate' ); + test.ok( human instanceof Animal, 'should be an instance of Animal' ); + + const message = 'hello'; + expected = message; + actual = human.speak( message ); + test.equal( actual, expected, 'should speak what it is asked to speak' ); + + test.end(); +}); From 5063597793d1cfb47840e6d24ff8e2114ac12ac2 Mon Sep 17 00:00:00 2001 From: sheriffderek Date: Sat, 10 Dec 2016 19:34:31 -0800 Subject: [PATCH 06/10] =?UTF-8?q?Adds=20test=20for=20typeof=20function=20t?= =?UTF-8?q?o=20ensure=20it=E2=80=99s=20a=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/spec.js b/src/spec.js index e079d9a..e0a2ae6 100644 --- a/src/spec.js +++ b/src/spec.js @@ -37,6 +37,9 @@ test('Animal exists', function(test) { test('Animal has speak method', function(test) { const animal = new Animal(); + + test.ok( typeof animal.speak === 'function', 'animal has method called speak' ); + const expected = 'generic sound'; const actual = animal.speak(expected); From 6d415f5d9e73a1e8a76f3ae5a7366f324de62398 Mon Sep 17 00:00:00 2001 From: sheriffderek Date: Sun, 11 Dec 2016 22:15:39 -0800 Subject: [PATCH 07/10] After noticing the .SOUND was something I needed to include --- src/index.js | 47 +++++++++++++++++++++++++++++++---------------- src/spec.js | 42 ++++++++++++------------------------------ 2 files changed, 43 insertions(+), 46 deletions(-) diff --git a/src/index.js b/src/index.js index 44d977f..bdadc87 100644 --- a/src/index.js +++ b/src/index.js @@ -1,33 +1,48 @@ -export function double ( x ) { - return x * 2; -} -export function doubleXTimes ( x, num ) { - let result = x; - for ( let i = 1; i <= num; i++ ) { - result = double( result ); - } - return result; -} +export function Animal() {}; -export function doubleEach ( arr ) { - return arr.map( double ); +Animal.SOUND = "generic sound"; + +Animal.prototype.speak = function() { + return Animal.SOUND; + // It seems like this should be relative + // so I don't have to repeat } -export function Animal() {}; -Animal.prototype.speak = function(sound) { - return sound; -} export function Reptile() {}; Reptile.prototype = Object.create(Animal.prototype); +Reptile.SOUND = 'rrreptile sound'; + +Reptile.prototype.speak = function() { + return Reptile.SOUND; + // seems like I should be able to override this + // in a better style +} + + + export function Primate() {}; Primate.prototype = Object.create(Animal.prototype); +Primate.SOUND = 'ooh ooh ah ah'; + +Primate.prototype.speak = function() { + return Primate.SOUND; +} + + + export function Human() {}; Human.prototype = Object.create(Primate.prototype); + +Human.SOUND = 'Well, hello sir.'; + +Human.prototype.speak = function(sound = Human.SOUND) { + return sound; +} diff --git a/src/spec.js b/src/spec.js index e0a2ae6..3639bff 100644 --- a/src/spec.js +++ b/src/spec.js @@ -1,39 +1,15 @@ import test from 'tape'; -import { double, doubleXTimes, doubleEach, Animal, Reptile, Primate, Human } from './index'; +import { Animal, Reptile, Primate, Human } from './index'; -test( 'double fn', function ( test ) { - const actual = double( 5 ); - const expected = 10; - - test.equal( actual, expected, 'should double the value' ); - - test.end(); -}); - -test( 'doubleXTimes', function ( test ) { - const actual = doubleXTimes( 5, 3 ); - const expected = 40; - - test.equal( actual, expected, 'should double 5 three times' ); - - test.end(); -}); - -test( 'doubleEach', function ( test ) { - const actual = doubleEach([ 0, 1, 2 ]); - const expected = [ 0, 2, 4 ]; +test('Animal is a constructor', function(test) { + const animal = new Animal(); - test.deepEqual( actual, expected, 'should double each in the array' ); + test.ok( animal instanceof Animal, 'should create an instance of Animal' ); test.end(); }); -test('Animal exists', function(test) { - const animal = new Animal(); - test.ok( animal instanceof Animal, 'should create an instance of Animal' ); - test.end(); -}); test('Animal has speak method', function(test) { const animal = new Animal(); @@ -41,12 +17,16 @@ test('Animal has speak method', function(test) { test.ok( typeof animal.speak === 'function', 'animal has method called speak' ); const expected = 'generic sound'; - const actual = animal.speak(expected); + const actual = animal.speak(); + + test.equal( actual, expected, 'animal can speak' ); + - test.equal( actual, expected, 'should make a generic sound when it speaks' ); test.end(); }); + + test('Checks Animal inheritance', function(test) { let actual, expected; @@ -71,6 +51,8 @@ test('Checks Animal inheritance', function(test) { test.end(); }); + + test('Adds Human', function(test) { let actual, expected; From a14e205768198aea5d13c7ca361077c926daab36 Mon Sep 17 00:00:00 2001 From: sheriffderek Date: Mon, 12 Dec 2016 20:35:27 -0800 Subject: [PATCH 08/10] Starting over for practice --- src/index.js | 48 ----------------------------------- src/spec.js | 71 +--------------------------------------------------- 2 files changed, 1 insertion(+), 118 deletions(-) diff --git a/src/index.js b/src/index.js index bdadc87..e69de29 100644 --- a/src/index.js +++ b/src/index.js @@ -1,48 +0,0 @@ - -export function Animal() {}; - -Animal.SOUND = "generic sound"; - -Animal.prototype.speak = function() { - return Animal.SOUND; - // It seems like this should be relative - // so I don't have to repeat -} - - - -export function Reptile() {}; - -Reptile.prototype = Object.create(Animal.prototype); - -Reptile.SOUND = 'rrreptile sound'; - -Reptile.prototype.speak = function() { - return Reptile.SOUND; - // seems like I should be able to override this - // in a better style -} - - - -export function Primate() {}; - -Primate.prototype = Object.create(Animal.prototype); - -Primate.SOUND = 'ooh ooh ah ah'; - -Primate.prototype.speak = function() { - return Primate.SOUND; -} - - - -export function Human() {}; - -Human.prototype = Object.create(Primate.prototype); - -Human.SOUND = 'Well, hello sir.'; - -Human.prototype.speak = function(sound = Human.SOUND) { - return sound; -} diff --git a/src/spec.js b/src/spec.js index 3639bff..2f79b07 100644 --- a/src/spec.js +++ b/src/spec.js @@ -1,71 +1,2 @@ import test from 'tape'; -import { Animal, Reptile, Primate, Human } from './index'; - -test('Animal is a constructor', function(test) { - const animal = new Animal(); - - test.ok( animal instanceof Animal, 'should create an instance of Animal' ); - - test.end(); -}); - - - -test('Animal has speak method', function(test) { - const animal = new Animal(); - - test.ok( typeof animal.speak === 'function', 'animal has method called speak' ); - - const expected = 'generic sound'; - const actual = animal.speak(); - - test.equal( actual, expected, 'animal can speak' ); - - - test.end(); -}); - - - -test('Checks Animal inheritance', function(test) { - let actual, expected; - - const reptile = new Reptile(); - - test.ok( reptile instanceof Reptile, 'should be an instance of Reptile' ); - test.ok( reptile instanceof Animal, 'should be an instance of Animal' ); - - expected = Reptile.SOUND; - actual = reptile.speak(); - test.equal( actual, expected, 'should make a reptile sound when it speaks' ); - - const primate = new Primate(); - - test.ok( primate instanceof Primate, 'should be an instance of Primate' ); - test.ok( primate instanceof Animal, 'should be an instance of Animal' ); - - expected = Primate.SOUND; - actual = primate.speak(); - test.equal( actual, expected, 'should make a primate sound when it speaks' ); - - test.end(); -}); - - - -test('Adds Human', function(test) { - let actual, expected; - - const human = new Human(); - - test.ok( human instanceof Human, 'should be an instance of Human' ); - test.ok( human instanceof Primate, 'should be an instance of Primate' ); - test.ok( human instanceof Animal, 'should be an instance of Animal' ); - - const message = 'hello'; - expected = message; - actual = human.speak( message ); - test.equal( actual, expected, 'should speak what it is asked to speak' ); - - test.end(); -}); +import { } from './index'; From c3c9c6391e5a7de9612f277ad3ea32b4fa4d168c Mon Sep 17 00:00:00 2001 From: sheriffderek Date: Mon, 12 Dec 2016 23:18:58 -0800 Subject: [PATCH 09/10] Re-writes everything - follow directions more closely --- README.md | 26 ++---------------- src/index.js | 53 ++++++++++++++++++++++++++++++++++++ src/spec.js | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 131 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 5e67af7..1c4133e 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,3 @@ -# Test Framework - -An empty project with Tape to demonstrate proper unit test writing. Part of a recent Intro to -JavaScript class I taught. - -## Running - -Follow the usual procedure for setting up NPM: - -```sh -$ npm install -```` - -And then run the unit tests via NPM scripts: - -```sh -$ npm test -# or npm run test -``` - -## Files - -Any file ending in `spec.js` anywhere within the source folder will be included in the running -tests. For an example, check out `src/spec.js`, which tests `src/index.js`. +# Hello +Questions and thoughs are in the comments. \ No newline at end of file diff --git a/src/index.js b/src/index.js index e69de29..644d4ff 100644 --- a/src/index.js +++ b/src/index.js @@ -0,0 +1,53 @@ + +// 1. Create a constructor function for Animal +// - Why is this a constructor if it doesn't return anything? +// - The 'new' word uses it to make something... +// - I don't like that... it's too black-box... +export const Animal = function() {}; + +// 2. Create a prototype for an Animal, +// - Well, by creating an Object literal... it inherited a prototype from Object already... +// - How would I create a prototype without adding anything? +// - This will happen with the creating of speak() but, just following orders +Animal.prototype = function() {}; + +// 3. Create a function on Animal ‘s prototype called speak that returns the animal’s sound. +Animal.prototype.speak = function(sound = Animal.SOUND) { + // default argument no bueno? + // should I 'if' an argument instead? + return 'generic sound'; +} + +// 4. Create two new constructors for Reptile and Primate +export const Reptile = function() {}; +export const Primate = function() {}; // ** Unnecessary, right? + +// 5. ...with prototypes that inherit from Animal +Reptile.prototype = Object.create(Animal.prototype); +Primate.prototype = Object.create(Animal.prototype); // ** + +// 6. Overwrite the speak method for each. +Reptile.prototype.speak = function(sound = Reptile.SOUND) { + return sound; +}; +Primate.prototype.speak = function(sound = Primate.SOUND) { + return sound; +}; + +// 6b. Looks like we need some SOUNDS... +// - I didn't understand what this was at first, but it's in the tests... +// - so, I have to give each constructor a 'constant' I guess... +// - "On the contrary... It is in uppercase because that's a common convention for constants defined on the constructor rather than on the prototype." +// - I still don't see the helpfulness of the all caps but I'm sure it's with reason to avoid some confusion +Reptile.SOUND = 'Slither slither'; +Primate.SOUND = 'Ug ug'; +// 6c. Go back up and add this as the default for speak() + +// 7. Create one more that inherits from Primate called Human +export const Human = function() {}; +Human.prototype = Object.create(Primate.prototype); +// I suppose the other's didn't need default sounds and I could have overrided that just here on Human. + +// Feels funny to only create things in the tests haha + +// Should this be worked into a factory function? diff --git a/src/spec.js b/src/spec.js index 2f79b07..2a3e9d2 100644 --- a/src/spec.js +++ b/src/spec.js @@ -1,2 +1,77 @@ import test from 'tape'; -import { } from './index'; +import { Animal, Reptile, Primate, Human } from './index'; + + + +test('Create a constructor function and a prototype for an Animal', function(test) { + + const animal = new Animal(); + + test.ok( animal instanceof Animal, 'should create an instance of Animal' ); + + test.end(); +}); + + + +test('Create a function on Animal ‘s prototype called speak that returns the animal’s sound.', function(test) { + + const animal = new Animal(); + const expected = 'generic sound'; + const actual = animal.speak(); + + test.equal( actual, expected, 'should make a generic sound when it speaks' ); + + test.end(); +}); + + + +test('Create two new constructors with prototypes that inherit from Animal: Reptile and Primate. Overwrite the speak method for each.', function(test) { + + let actual, expected; + + const reptile = new Reptile(); + + test.ok( reptile instanceof Reptile, 'should be an instance of Reptile' ); + test.ok( reptile instanceof Animal, 'should be an instance of Animal' ); + + expected = Reptile.SOUND; + // "It is in uppercase because that's a common convention + // for constants defined on the constructor rather than on the prototype." + actual = reptile.speak(); + console.log(`* Reptile says, "${actual}"`); + test.equal( actual, expected, 'should make a reptile sound when it speaks' ); + + const primate = new Primate(); + + test.ok( primate instanceof Primate, 'should be an instance of Primate' ); + test.ok( primate instanceof Animal, 'should be an instance of Animal' ); + + expected = Primate.SOUND; + actual = primate.speak(); + console.log(`* Primate, says, "${actual}"`); + test.equal( actual, expected, 'should make a primate sound when it speaks' ); + test.end(); +}); + + + +test('Create one more that inherits from Primate called Human.', function(test) { + + let actual, expected; + + const human = new Human(); + + test.ok( human instanceof Human, 'should be an instance of Human' ); + test.ok( human instanceof Primate, 'should be an instance of Primate' ); + test.ok( human instanceof Animal, 'should be an instance of Animal' ); + + const message = 'Hello'; + expected = message; + actual = human.speak( message ); + console.log(`* Human says, "${actual}"`); + test.equal( actual, expected, 'should speak what it is asked to speak' ); + + test.end(); +}); From f323d9690dde6a4e6a159b19ad0aa1ab587c3c24 Mon Sep 17 00:00:00 2001 From: sheriffderek Date: Thu, 15 Dec 2016 16:34:34 -0800 Subject: [PATCH 10/10] Clean up + addresses added speak parameter --- src/index.js | 55 ++++++++++++++-------------------------------------- src/spec.js | 3 +-- 2 files changed, 16 insertions(+), 42 deletions(-) diff --git a/src/index.js b/src/index.js index 644d4ff..ef07b46 100644 --- a/src/index.js +++ b/src/index.js @@ -1,53 +1,28 @@ -// 1. Create a constructor function for Animal -// - Why is this a constructor if it doesn't return anything? -// - The 'new' word uses it to make something... -// - I don't like that... it's too black-box... -export const Animal = function() {}; - -// 2. Create a prototype for an Animal, -// - Well, by creating an Object literal... it inherited a prototype from Object already... -// - How would I create a prototype without adding anything? -// - This will happen with the creating of speak() but, just following orders +const Animal = function() {}; Animal.prototype = function() {}; - -// 3. Create a function on Animal ‘s prototype called speak that returns the animal’s sound. -Animal.prototype.speak = function(sound = Animal.SOUND) { - // default argument no bueno? - // should I 'if' an argument instead? +Animal.prototype.speak = function() { return 'generic sound'; } -// 4. Create two new constructors for Reptile and Primate -export const Reptile = function() {}; -export const Primate = function() {}; // ** Unnecessary, right? - -// 5. ...with prototypes that inherit from Animal +const Reptile = function() {}; Reptile.prototype = Object.create(Animal.prototype); -Primate.prototype = Object.create(Animal.prototype); // ** - -// 6. Overwrite the speak method for each. +Reptile.SOUND = 'Slither slither'; Reptile.prototype.speak = function(sound = Reptile.SOUND) { - return sound; -}; -Primate.prototype.speak = function(sound = Primate.SOUND) { - return sound; + return Reptile.SOUND; }; -// 6b. Looks like we need some SOUNDS... -// - I didn't understand what this was at first, but it's in the tests... -// - so, I have to give each constructor a 'constant' I guess... -// - "On the contrary... It is in uppercase because that's a common convention for constants defined on the constructor rather than on the prototype." -// - I still don't see the helpfulness of the all caps but I'm sure it's with reason to avoid some confusion -Reptile.SOUND = 'Slither slither'; +const Primate = function() {}; +Primate.prototype = Object.create(Animal.prototype); Primate.SOUND = 'Ug ug'; -// 6c. Go back up and add this as the default for speak() +Primate.prototype.speak = function(sound = Primate.SOUND) { + return Primate.SOUND; +}; -// 7. Create one more that inherits from Primate called Human -export const Human = function() {}; +const Human = function() {}; Human.prototype = Object.create(Primate.prototype); -// I suppose the other's didn't need default sounds and I could have overrided that just here on Human. - -// Feels funny to only create things in the tests haha +Human.prototype.speak = function(sound) { + return sound; +}; -// Should this be worked into a factory function? +export { Animal, Reptile, Primate, Human }; diff --git a/src/spec.js b/src/spec.js index 2a3e9d2..eef9f81 100644 --- a/src/spec.js +++ b/src/spec.js @@ -37,8 +37,7 @@ test('Create two new constructors with prototypes that inherit from Animal: Rept test.ok( reptile instanceof Animal, 'should be an instance of Animal' ); expected = Reptile.SOUND; - // "It is in uppercase because that's a common convention - // for constants defined on the constructor rather than on the prototype." + actual = reptile.speak(); console.log(`* Reptile says, "${actual}"`); test.equal( actual, expected, 'should make a reptile sound when it speaks' );