This commit is contained in:
Leandro Facchinetti 2020-03-20 13:48:53 -04:00
parent 466f6058d0
commit f1f8ef6ee4
3 changed files with 37 additions and 39 deletions

54
package-lock.json generated
View File

@ -932,16 +932,6 @@
"integrity": "sha512-bnoqK579sAYrQbp73wwglccjJ4sfRdKU7WNEZ5FW4K2U6Kc0/eZ5kvXG0JKsEKFB50zrFmfFt52/cvBbZa7eXg==", "integrity": "sha512-bnoqK579sAYrQbp73wwglccjJ4sfRdKU7WNEZ5FW4K2U6Kc0/eZ5kvXG0JKsEKFB50zrFmfFt52/cvBbZa7eXg==",
"dev": true "dev": true
}, },
"@types/node-fetch": {
"version": "2.5.5",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.5.tgz",
"integrity": "sha512-IWwjsyYjGw+em3xTvWVQi5MgYKbRs0du57klfTaZkv/B24AEQ/p/IopNeqIYNy3EsfHOpg8ieQSDomPcsYMHpA==",
"dev": true,
"requires": {
"@types/node": "*",
"form-data": "^3.0.0"
}
},
"@types/nodemailer": { "@types/nodemailer": {
"version": "6.4.0", "version": "6.4.0",
"resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-6.4.0.tgz", "resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-6.4.0.tgz",
@ -957,6 +947,12 @@
"integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==", "integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==",
"dev": true "dev": true
}, },
"@types/qs": {
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.1.tgz",
"integrity": "sha512-lhbQXx9HKZAPgBkISrBcmAcMpZsmpe/Cd/hY7LGZS5OfkySUBItnPZHgQPssWYUET8elF+yCFBbP1Q0RZPTdaw==",
"dev": true
},
"@types/range-parser": { "@types/range-parser": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz", "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz",
@ -1477,6 +1473,13 @@
"qs": "6.7.0", "qs": "6.7.0",
"raw-body": "2.4.0", "raw-body": "2.4.0",
"type-is": "~1.6.17" "type-is": "~1.6.17"
},
"dependencies": {
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
}
} }
}, },
"boxen": { "boxen": {
@ -2608,6 +2611,13 @@
"type-is": "~1.6.18", "type-is": "~1.6.18",
"utils-merge": "1.0.1", "utils-merge": "1.0.1",
"vary": "~1.1.2" "vary": "~1.1.2"
},
"dependencies": {
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
}
} }
}, },
"extend": { "extend": {
@ -2804,17 +2814,6 @@
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
"dev": true "dev": true
}, },
"form-data": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz",
"integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==",
"dev": true,
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
},
"forwarded": { "forwarded": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
@ -4967,12 +4966,6 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true "dev": true
}, },
"node-fetch": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==",
"dev": true
},
"node-int64": { "node-int64": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",
@ -5870,9 +5863,10 @@
"dev": true "dev": true
}, },
"qs": { "qs": {
"version": "6.7.0", "version": "6.9.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.1.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" "integrity": "sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA==",
"dev": true
}, },
"range-parser": { "range-parser": {
"version": "1.2.1", "version": "1.2.1",

View File

@ -19,18 +19,19 @@
"@types/jest": "^25.1.4", "@types/jest": "^25.1.4",
"@types/mailparser": "^2.7.0", "@types/mailparser": "^2.7.0",
"@types/node": "^13.9.1", "@types/node": "^13.9.1",
"@types/node-fetch": "^2.5.5",
"@types/nodemailer": "^6.4.0", "@types/nodemailer": "^6.4.0",
"@types/qs": "^6.9.1",
"@types/react": "^16.9.23", "@types/react": "^16.9.23",
"@types/react-dom": "^16.9.5", "@types/react-dom": "^16.9.5",
"@types/smtp-server": "^3.5.3", "@types/smtp-server": "^3.5.3",
"@types/xml2js": "^0.4.5", "@types/xml2js": "^0.4.5",
"axios": "^0.19.2",
"concurrently": "^5.1.0", "concurrently": "^5.1.0",
"jest": "^25.1.0", "jest": "^25.1.0",
"node-fetch": "^2.6.0",
"nodemailer": "^6.4.5", "nodemailer": "^6.4.5",
"nodemon": "^2.0.2", "nodemon": "^2.0.2",
"prettier": "^1.19.1", "prettier": "^1.19.1",
"qs": "^6.9.1",
"typescript": "^3.8.3" "typescript": "^3.8.3"
}, },
"jest": { "jest": {

View File

@ -5,7 +5,8 @@ import {
feedEmail feedEmail
} from "."; } from ".";
import nodemailer from "nodemailer"; import nodemailer from "nodemailer";
import fetch from "node-fetch"; import axios from "axios";
import qs from "qs";
import fs from "fs"; import fs from "fs";
test("create feed", async () => { test("create feed", async () => {
@ -68,12 +69,14 @@ afterAll(() => {
}); });
async function createFeed(): Promise<string> { async function createFeed(): Promise<string> {
const response = await fetch("http://localhost:8000", { return (
method: "POST", await axios.post(
body: new URLSearchParams({ name: "My Feed" }) "http://localhost:8000",
}); qs.stringify({
const responseText = await response.text(); name: "My Feed"
return responseText.match(/(\w{20}).xml/)![1]; })
)
).data.match(/(\w{20}).xml/)![1];
} }
function readFeed(token: string): string { function readFeed(token: string): string {