-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from The-Island/update
Update
- Loading branch information
Showing
6 changed files
with
118 additions
and
23 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,20 +2,24 @@ | |
"private": true, | ||
"author": "The Island (git://github.com/The-Island)", | ||
"name": "island-emailer", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/The-Island/island-emailer.git" | ||
}, | ||
"main": "lib/emailer", | ||
"dependencies": { | ||
"underscore": "^1.4.4", | ||
"underscore.string": "~2.3.1", | ||
"step": "0.0.5", | ||
"emailjstmp": "~0.3.4", | ||
"jade": "~0.30.0" | ||
"emailjs": "^1.0.8", | ||
"island-boots": "git+https://island-ebs:[email protected]/The-Island/island-boots.git#0.0.2", | ||
"pug": "^2.0.0-beta11", | ||
"step": "1.0.0", | ||
"underscore": "~1.8.3", | ||
"underscore.string": "~3.3.4" | ||
}, | ||
"engines": { | ||
"node": "~0.10.26" | ||
"devDependencies": { | ||
"mocha": "^3.2.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"GMAIL_FROM": "Island <[email protected]>", | ||
"GMAIL_USER": "[email protected]", | ||
"GMAIL_HOST": "smtp.gmail.com", | ||
"GMAIL_PASSWORD": "I514nDr06ot", | ||
"GMAIL_SSL": true | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
var _ = require('underscore'); | ||
var assert = require('assert'); | ||
var boots = require('island-boots'); | ||
var Emailer = require('../lib/emailer').Emailer; | ||
|
||
var config = {}; | ||
_.each(require('./config.json'), function (v, k) { | ||
config[k] = v; | ||
}); | ||
|
||
var member = { | ||
"displayName": "Sander Pick", | ||
"primaryEmail": "[email protected]" | ||
} | ||
|
||
var notification = { | ||
"_id" : "51f84e397f6fa8395c00000d", | ||
"subscriber_id" : "4dc79a601104feb30b000e75", | ||
"subscription_id" : "51f826917f6fa8395c000005", | ||
"read" : false, | ||
"event" : { | ||
"_id" : "51f84e397f6fa8395c00000b", | ||
"action_id" : "51f84e397f6fa8395c00000a", | ||
"action_type" : "comment", | ||
"actor_id" : "4dc78c61ed47376c0b000001", | ||
"data" : { | ||
"action" : { | ||
"i" : "4dc78c61ed47376c0b000001", | ||
"a" : "Tester", | ||
"g" : "ac38ba214848deb3184905444d9dc9f3", | ||
"t" : "comment", | ||
"b" : "Haha amazing!" | ||
}, | ||
"target" : { | ||
"i" : "4dc79a601104feb30b000e75", | ||
"a" : "Cooper Roberts", | ||
"n" : "Test post", | ||
"t" : "post", | ||
"s" : "test/test" | ||
} | ||
}, | ||
"target_id" : "51f826917f6fa8395c000003" | ||
} | ||
} | ||
|
||
describe('island-emailer', function() { | ||
this.timeout(10000); | ||
var db; | ||
var emailer; | ||
|
||
before(function(done) { | ||
boots.start(function (client) { | ||
db = client.get('db'); | ||
emailer = new Emailer({ | ||
db: client.get('db'), | ||
user: config.GMAIL_USER, | ||
password: config.GMAIL_PASSWORD, | ||
from: config.GMAIL_FROM, | ||
host: config.GMAIL_HOST, | ||
ssl: config.GMAIL_SSL, | ||
baseURI: 'https://test.island.io', | ||
mock: false | ||
}); | ||
member._id = db.oid() | ||
done(); | ||
}); | ||
}); | ||
|
||
describe('#reset()', function() { | ||
it('should send a password reset email', function(done) { | ||
emailer.reset(member, function(err) { | ||
if (err) done(err); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('#notify()', function() { | ||
it('should send a notify email', function(done) { | ||
emailer.notify(member, notification, 'this is a test', function(err) { | ||
if (err) done(err); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.