TentaCrew / STOFMA

Student Office Manager, manage your cafeteria sales and purchases easily.
http://dev.bde-ciaa.fr
5 stars 3 forks source link

Tests failing with the sails-memory adapter #17

Closed fwoelffel closed 9 years ago

fwoelffel commented 9 years ago

Hi,

Some tests are failing when using the sails-memory adapter. Here is my mocha output:

/usr/local/bin/node /Users/fwoelffel/Dev/STOFMA/node_modules/mocha/bin/_mocha --recursive --ui bdd --reporter /Applications/WebStorm.app/Contents/plugins/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js /Users/fwoelffel/Dev/STOFMA/test

TypeError: Cannot read property 'totalPrice' of undefined
    at api/models/Purchase.js:68:34

TypeError: Cannot read property 'totalPrice' of undefined
    at api/models/Purchase.js:68:34

TypeError: Cannot read property 'totalPrice' of undefined
    at api/models/Sale.js:72:34

TypeError: Cannot read property 'totalPrice' of undefined
    at api/models/Sale.js:72:34

AssertionError: New credit is wrong.
Expected :10
Actual   :20
 <Click to see difference>

    at test/unit/controllers/UserController.test.js:362:20

AssertionError: New credit is wrong.
Expected :10
Actual   :30
 <Click to see difference>

    at test/unit/controllers/UserController.test.js:398:20

Process finished with exit code 6

To reproduce this issue, apply the following patch and run the test suite.

diff --git a/test/bootstrap.test.js b/test/bootstrap.test.js
index ef77133..427cb78 100755
--- a/test/bootstrap.test.js
+++ b/test/bootstrap.test.js
@@ -3,13 +3,7 @@ var data = require('./datatest.js');

 before(function(done) {
   Sails.lift({
-    log: {
-      level: 'error'
-    },
-    models: {
-      connection: 'localDiskDb',
-      migrate: 'drop'
-    }
+    environment: 'test'
   }, function(){

     async.parallel({
corentindesfarges commented 9 years ago

Closed in the commit