|
@@ -1,79 +1,75 @@
|
|
|
var chakram = require("./../setup.js").chakram;
|
|
|
var expect = chakram.expect;
|
|
|
|
|
|
-describe("dyndns service", function () {
|
|
|
-
|
|
|
- // ('name', 'iban', 'bic', 'amount', 'message', 'email')
|
|
|
- var apiDonationSchema = {
|
|
|
- properties: {
|
|
|
- name: {type: "string"},
|
|
|
- iban: {type: "string"},
|
|
|
- bic: {type: "string"},
|
|
|
- amount: {type: "string"},
|
|
|
- message: {type: "string"},
|
|
|
- email: {type: "string"},
|
|
|
+// ('name', 'iban', 'bic', 'amount', 'message', 'email')
|
|
|
+var apiDonationSchema = {
|
|
|
+ properties: {
|
|
|
+ name: {type: "string"},
|
|
|
+ iban: {type: "string"},
|
|
|
+ bic: {type: "string"},
|
|
|
+ amount: {type: "string"},
|
|
|
+ message: {type: "string"},
|
|
|
+ email: {type: "string"},
|
|
|
+ },
|
|
|
+ required: ["name", "iban", "bic", "amount"]
|
|
|
+};
|
|
|
+
|
|
|
+before(function () {
|
|
|
+ chakram.setRequestSettings({
|
|
|
+ headers: {
|
|
|
+ 'Host': 'desec.' + process.env.DESECSTACK_DOMAIN,
|
|
|
},
|
|
|
- required: ["name", "iban", "bic", "amount"]
|
|
|
- };
|
|
|
-
|
|
|
- before(function () {
|
|
|
- chakram.setRequestSettings({
|
|
|
- headers: {
|
|
|
- 'Host': 'desec.' + process.env.DESECSTACK_DOMAIN,
|
|
|
- },
|
|
|
- followRedirect: false,
|
|
|
- baseUrl: 'https://www/api/v1',
|
|
|
- });
|
|
|
+ followRedirect: false,
|
|
|
+ baseUrl: 'https://www/api/v1',
|
|
|
});
|
|
|
+});
|
|
|
|
|
|
- describe("donating", function () {
|
|
|
+describe("donating", function () {
|
|
|
|
|
|
- describe("without message and IBAN containing spaces", function () {
|
|
|
+ describe("without message and IBAN containing spaces", function () {
|
|
|
|
|
|
- var response;
|
|
|
- var iban = "DE89 3704 0044 0532 0130 00";
|
|
|
+ var response;
|
|
|
+ var iban = "DE89 3704 0044 0532 0130 00";
|
|
|
|
|
|
- before(function() {
|
|
|
- response = chakram.post('/donation/', {
|
|
|
- "name": "Drama Queen",
|
|
|
- "iban": iban,
|
|
|
- "bic": "MARKDEF1100",
|
|
|
- "amount": "3.14",
|
|
|
- "email": "drama@queen.world",
|
|
|
- });
|
|
|
+ before(function() {
|
|
|
+ response = chakram.post('/donation/', {
|
|
|
+ "name": "Drama Queen",
|
|
|
+ "iban": iban,
|
|
|
+ "bic": "MARKDEF1100",
|
|
|
+ "amount": "3.14",
|
|
|
+ "email": "drama@queen.world",
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it("goes through", function () {
|
|
|
- return expect(response).to.have.status(201);
|
|
|
- });
|
|
|
+ it("goes through", function () {
|
|
|
+ return expect(response).to.have.status(201);
|
|
|
+ });
|
|
|
|
|
|
- it("follows donation schema", function () {
|
|
|
- return expect(response).to.have.schema(apiDonationSchema);
|
|
|
- });
|
|
|
+ it("follows donation schema", function () {
|
|
|
+ return expect(response).to.have.schema(apiDonationSchema);
|
|
|
+ });
|
|
|
|
|
|
- it("does not return the full iban", function () {
|
|
|
- return response.then(function (donationResponse) {
|
|
|
- expect(donationResponse.body.iban).to.not.contain(iban);
|
|
|
- });
|
|
|
+ it("does not return the full iban", function () {
|
|
|
+ return response.then(function (donationResponse) {
|
|
|
+ expect(donationResponse.body.iban).to.equal("DE8937xxx");
|
|
|
});
|
|
|
-
|
|
|
});
|
|
|
|
|
|
- it("does not require an email address", function () {
|
|
|
- var email, password, token;
|
|
|
+ });
|
|
|
|
|
|
- var response = chakram.post('/donation/', {
|
|
|
- "name": "Drama Queen",
|
|
|
- "iban": "DE89370400440532013000",
|
|
|
- "bic": "MARKDEF1100",
|
|
|
- "amount": "3.14",
|
|
|
- });
|
|
|
+ it("does not require an email address", function () {
|
|
|
+ var email, password, token;
|
|
|
|
|
|
- return expect(response).to.have.status(201);
|
|
|
+ var response = chakram.post('/donation/', {
|
|
|
+ "name": "Drama Queen",
|
|
|
+ "iban": "DE89370400440532013000",
|
|
|
+ "bic": "MARKDEF1100",
|
|
|
+ "amount": "3.14",
|
|
|
});
|
|
|
|
|
|
- // TODO it(sends emails)
|
|
|
-
|
|
|
+ return expect(response).to.have.status(201);
|
|
|
});
|
|
|
|
|
|
+ // TODO it(sends emails)
|
|
|
+
|
|
|
});
|