Skip to content

Instantly share code, notes, and snippets.

@PCreations
Last active September 4, 2020 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PCreations/b3247d54d760efdc9028dba6ed878bf7 to your computer and use it in GitHub Desktop.
Save PCreations/b3247d54d760efdc9028dba6ed878bf7 to your computer and use it in GitHub Desktop.
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