Permalink
Browse files

added untracked files

  • Loading branch information...
1 parent 8855f04 commit c38994a68f23221df64b35698736bcc4743ab882 @jamescarr committed Mar 6, 2012
Showing with 91 additions and 0 deletions.
  1. +24 −0 package.json
  2. +29 −0 readme.md
  3. +38 −0 test/integration-test.coffee
View
@@ -0,0 +1,24 @@
+{
+ "author": "Bryan Helmig",
+ "name": "imap-json-poster",
+ "version": "0.0.1",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/bryanhelmig/node-imap-json-poster.git"
+ },
+ "engines": {
+ "node": "~0.6.6"
+ },
+ "dependencies": {
+ "imap":"0.2.8"
+ , "request":"2.9.153"
+ , "mailparser":"0.2.22"
+ },
+ "devDependencies": {
+ "should":"0.6.0"
+ , "mocha":"0.14.0"
+ , "express":"2.5.8"
+ , "eyes":"*"
+ },
+ "optionalDependencies": {}
+}
View
@@ -0,0 +1,29 @@
+# IMAP + Webhook Spike
+Spike of posting emails from an imap server to a webservice.
+
+
+## Running It
+Edit config.json to include your actual credentials
+
+From the project dir:
+
+```bash
+$ npm install
+```
+
+then
+
+```bash
+$ coffee getit
+```
+## Tests
+Tests can be ran by typing
+
+```bash
+mocha -t 10000
+```
+
+The -t option is needed because the initial hookup to gmail seems to
+take awhile so we give the test 10 seconds to do its thing. Test assumes
+that config.json points to the url http://localhost:3001/example.
+
@@ -0,0 +1,38 @@
+should = require 'should'
+express = require 'express'
+app = express.createServer()
+eyes = require 'eyes'
+emitter = new(require('events').EventEmitter)
+
+
+###
+# Dummy Server to listen for requests
+###
+app.configure ->
+ app.use(express.bodyParser())
+
+app.post '/example', (req, res) ->
+ emitter.emit '/request/received', req.body
+
+
+###
+# Test
+###
+describe 'Application', ->
+ before (done) ->
+ app.listen 3001, ->
+ console.log "server listening on port #{app.address().port}"
+ done()
+ after ->
+ app.close()
+
+ it 'should just freeaking work', (done)->
+ require('../read')
+ # listen for it only once, don't care about the others
+ emitter.once '/request/received', (content) ->
+ content.should.have.property 'headers'
+ content.headers.should.have.property 'return-path'
+ done()
+
+
+

0 comments on commit c38994a

Please sign in to comment.