Permalink
Browse files

Merge branch 'add/tests' of github.com:LearnBoost/mandrill-send into …

…add/tests
  • Loading branch information...
rauchg committed Feb 12, 2013
2 parents bc2e8f8 + cb136db commit 48c6a8acae9bfa8ae91f02f3dff119cc313949ae
Showing with 57 additions and 5 deletions.
  1. +2 −0 .gitignore
  2. +10 −0 Makefile
  3. +5 −5 index.js
  4. +5 −0 package.json
  5. +4 −0 test/config.js
  6. +31 −0 test/index.js
View
@@ -1 +1,3 @@
node_modules
+test/config.js
+npm-debug.log
View
@@ -0,0 +1,10 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --require should \
+ --timeout 10s \
+ --slow 3s \
+ --bail \
+ --reporter spec
+
+.PHONY: test
View
@@ -62,10 +62,10 @@ function create(key){
}
send(key, opts, fn);
- };
+ }
return email;
-};
+}
/**
* Sends a message through the mandrill API.
@@ -90,7 +90,7 @@ function send(key, message, fn){
fn(err);
}
});
-};
+}
/**
* Parses "A B <c@d.com>" into mandrill {email,name} format.
@@ -107,7 +107,7 @@ function parse(email){
} else {
return { email: email };
}
-};
+}
/**
* Placeholder callback.
@@ -118,4 +118,4 @@ function parse(email){
function empty (err) {
if (err) return console.error(err.stack || err);
-};
+}
View
@@ -5,5 +5,10 @@
"dependencies": {
"superagent": "0.12.4",
"debug": "*"
+ },
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*",
+ "expect.js": "*"
}
}
View
@@ -0,0 +1,4 @@
+
+module.exports = {
+ 'key': '<your api key here>'
+};
View
@@ -0,0 +1,31 @@
+
+/**
+ * Module dependencies
+ */
+
+var mandrill = require('../')
+ , config = require('./config')
+ , expect = require('expect.js');
+
+/**
+ * Create Mandill-send instance
+ */
+var email = mandrill(config.key);
+
+describe('send a simple email', function(){
+ it('expect `null` error response', function(done){
+
+ email({
+ from: 'From <from@email.com>',
+ to: [
+ 'to@email.com',
+ { name: 'The other guy', email: 'the.other.guy@email.net' }
+ ],
+ subject: 'Testing signup',
+ tags: ['signup', 'welcome']
+ }, function(err){
+ expect(err).to.equal(null);
+ done();
+ });
+ });
+});

0 comments on commit 48c6a8a

Please sign in to comment.