Last active
September 4, 2020 14:38
-
-
Save PCreations/b3247d54d760efdc9028dba6ed878bf7 to your computer and use it in GitHub Desktop.
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
import { createS3xmlUploader } from "../../s3-xml-uploader"; | |
describe("s3xmlUploader", () => { | |
it("uploads the xml to the S3 bucket", async () => { | |
// arrange | |
const xmlUploader = createS3xmlUploader({ | |
bucketName: process.env.S3_BUCKET, | |
}); | |
const xmlString = | |
'<?xml version="1.0" encoding="UTF-8"?><hello><to>Test</to></hello>'; | |
const domain = "www.my-website.co.uk"; | |
// act & assert | |
await expect( | |
xmlUploader.upload({ | |
domain, | |
xmlString, | |
}) | |
).resolves.not.toThrow(); | |
expect(xmlUploader.getLastPutObject()).toEqual({ | |
Bucket: process.env.S3_BUCKET, | |
Key: "www.my-website.co.uk/sitemap.xml", | |
Body: xmlString, | |
ContentType: "application/xml", | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment