Created
November 26, 2020 09:35
-
-
Save qunabu/fbd38d6046da2cc2d6548f7a599fbcdb to your computer and use it in GitHub Desktop.
Mockowanie API
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
const request = require("supertest"); | |
jest.mock("node-fetch", () => require("fetch-mock-jest").sandbox()); | |
const fetchMock = require("node-fetch"); | |
it("validates general PDF investment for user", async (done) => { | |
fetchMock.mock("https://weryfikacjapodpisu.pl/api/verify", { | |
body: fs.readFileSync("./tests/poa/weryf_correct.json", "utf8"), | |
}); | |
await request(app.server) | |
.post("/poas/validate") | |
.set("Authorization", "Bearer " + jwt) | |
.attach("attachment", "./tests/poa/__test-general.pdf.xml") | |
.expect("Content-Type", /json/) | |
.expect(200); | |
done(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment