aboutsummaryrefslogtreecommitdiff
path: root/webAO/services/__tests__
diff options
context:
space:
mode:
authorstonedDiscord <stonedDiscord@users.noreply.github.com>2024-11-20 13:31:50 +0000
committerGitHub Action <actions@github.com>2024-11-20 13:31:50 +0000
commit6684f3fce6e90fd0574d7bab63b629554ab03ef6 (patch)
treeb2a62247d17e23a77af57aea355ba621666817c2 /webAO/services/__tests__
parent95a2d1361d84c61b454ebe506e6963b93f6d8dee (diff)
Prettified Code!
Diffstat (limited to 'webAO/services/__tests__')
-rw-r--r--webAO/services/__tests__/downloadFile.test.ts48
1 files changed, 24 insertions, 24 deletions
diff --git a/webAO/services/__tests__/downloadFile.test.ts b/webAO/services/__tests__/downloadFile.test.ts
index b541095..c37c735 100644
--- a/webAO/services/__tests__/downloadFile.test.ts
+++ b/webAO/services/__tests__/downloadFile.test.ts
@@ -1,27 +1,27 @@
-import downloadFile from '../downloadFile'
-jest
- .useFakeTimers()
- .setSystemTime(new Date('2020-01-01').getTime());
+import downloadFile from "../downloadFile";
+jest.useFakeTimers().setSystemTime(new Date("2020-01-01").getTime());
global.URL.createObjectURL = jest.fn();
-(window as any).global.Blob = function (content, options){return ({content, options})}
+(window as any).global.Blob = function (content, options) {
+ return { content, options };
+};
-describe('downloadFile', () => {
- it('Creates an <a> tag', () => {
- const createElementSpy = jest.spyOn(document, 'createElement');
- downloadFile('hi', 'filename')
- expect(createElementSpy).toBeCalled()
- })
- it('Creates the blob with the correct data', () => {
- const data = 'writingtestsishard'
- global.URL.createObjectURL = jest.fn(() => data);
- downloadFile(data, 'filename')
- const expected = {
- content: [data],
- options: {
- type: "text"
- }
- }
- expect(global.URL.createObjectURL).toBeCalledWith(expected)
- })
-}) \ No newline at end of file
+describe("downloadFile", () => {
+ it("Creates an <a> tag", () => {
+ const createElementSpy = jest.spyOn(document, "createElement");
+ downloadFile("hi", "filename");
+ expect(createElementSpy).toBeCalled();
+ });
+ it("Creates the blob with the correct data", () => {
+ const data = "writingtestsishard";
+ global.URL.createObjectURL = jest.fn(() => data);
+ downloadFile(data, "filename");
+ const expected = {
+ content: [data],
+ options: {
+ type: "text",
+ },
+ };
+ expect(global.URL.createObjectURL).toBeCalledWith(expected);
+ });
+});