Created
February 28, 2014 14:55
-
-
Save hugeuser/9272508 to your computer and use it in GitHub Desktop.
TDD format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'), | |
request = require('supertest'), | |
should = require('should'), | |
app = require('../server'), | |
connection = require('../database'); | |
suite('Landing page functionality', function(){ | |
setup(function (done) { | |
this.timeout(5000); | |
async.series([ | |
function (cb) { | |
connection.query('INSERT INTO mocha_test_table '+ | |
'VALUE("TEST","TEST","","");',function(err){ | |
done(); | |
}); | |
}, | |
function (cb) { | |
connection.query('SELECT * FROM mocha_test_table WHERE user_name="TEST"'+ | |
' AND email="TEST";',function(err,results){ | |
results.length.should.not.equal(0); | |
done(); | |
}); | |
} | |
], done); | |
}); | |
test('Text of landing page', function(done){ | |
request(app) | |
.get('/') | |
.expect(200) | |
.end(function (err, res) { | |
res.text.should.include('Home'); | |
done(); | |
}); | |
}); | |
}); | |
// Find the rest of the test code in the source link below |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment