This repository has been archived by the owner on Sep 27, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rough promotion list with failing tests
- Loading branch information
1 parent
806840c
commit e49250f
Showing
4 changed files
with
108 additions
and
30 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 |
---|---|---|
@@ -1,19 +1,24 @@ | ||
var Madmimi = require('../lib/index'); | ||
|
||
var madmimi = new Madmimi(process.env['email'],process.env["madmimi_api_key"], true); | ||
|
||
var madmimi = new Madmimi("email","api_key"); | ||
/*var options = { | ||
promotion_name:"Test Promotion", | ||
recipient:"Jimi Hendrix <jimi@electricladyland.com>", | ||
subject:"Test Promotion", | ||
from:"no-reply@guitargear.com", | ||
raw_html:"<html><head><title>Great promotion!</title></head><body>Cool guitar stuff[[tracking_beacon]]</body></html>" | ||
}; | ||
var options = { | ||
promotion_name:"Test Promotion", | ||
recipient:"Jimi Hendrix <jimi@electricladyland.com>", | ||
subject:"Test Promotion", | ||
from:"no-reply@guitargear.com", | ||
raw_html:"<html><head><title>Great promotion!</title></head><body>Cool guitar stuff[[tracking_beacon]]</body></html>" | ||
}; | ||
|
||
madmimi.sendMail(options, function (msg) { | ||
madmimi.sendMail(options, function (msg) { | ||
console.log("email send, the id is: " + msg); | ||
}); | ||
}); | ||
madmimi.mailStatus(2861240550, function (msg) { | ||
madmimi.mailStatus(2861240550, function (msg) { | ||
console.log("status: " + msg); | ||
});*/ | ||
|
||
|
||
madmimi.promotions(function (promotions) { | ||
console.dir(promotions); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
var describe = require('Jody').describe, | ||
Madmimi = require('../lib/index.js'); | ||
|
||
var madmimi = ""; | ||
var email_options = { | ||
promotion_name:"Test Promotion", | ||
recipient:"Jimi Hendrix <jimi@electricladyland.com>", | ||
subject:"Test Promotion", | ||
from:"no-reply@guitargear.com", | ||
raw_html:"<html><head><title>Great promotion!</title></head><body>Cool guitar stuff[[tracking_beacon]]</body></html>" | ||
}; | ||
|
||
|
||
describe("Promotions"). | ||
beforeEach( function () { | ||
madmimi = new Madmimi("fake@email.com", "fake-api-key"); | ||
}). | ||
it("Should create http request for all promotions", function (atEnd) { | ||
var requestOptions; | ||
|
||
madmimi.request = function (options, body) { | ||
requestOptions = options; | ||
}; | ||
|
||
madmimi.promotions(function () {}); | ||
|
||
atEnd(function () { | ||
requestOptions.host.should().beEqual('madmimi.com'); | ||
requestOptions.port.should().beEqual('443'); | ||
requestOptions.path.should().beEqual('/mailers/status/1234?username=fake%40email.com&api_key=fake-api-key'); | ||
requestOptions.method.should().beEqual('GET'); | ||
}) | ||
}); | ||
|