Skip to content

Commit

Permalink
chore: file_type -> fileType
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Nov 13, 2023
1 parent 928ece2 commit b7017e2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
3 changes: 1 addition & 2 deletions api.planx.uk/modules/file/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ assert(process.env.AWS_ACCESS_KEY);
assert(process.env.AWS_SECRET_KEY);

interface UploadFileResponse {
// TODO: change to snake case
file_type: string | null;
fileType: string | null;
fileUrl: string;
}

Expand Down
4 changes: 2 additions & 2 deletions api.planx.uk/modules/file/file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe("File upload", () => {
.attach("file", Buffer.from("some data"), "some_file.txt")
.then((res) => {
expect(res.body).toEqual({
file_type: "text/plain",
fileType: "text/plain",
fileUrl: expect.stringContaining(
"/file/private/nanoid/modified%20key",
),
Expand Down Expand Up @@ -135,7 +135,7 @@ describe("File upload", () => {
.attach("file", Buffer.from("some data"), "some_file.txt")
.then((res) => {
expect(res.body).toEqual({
file_type: "text/plain",
fileType: "text/plain",
fileUrl: expect.stringContaining(
"file/public/nanoid/modified%20key",
),
Expand Down
4 changes: 2 additions & 2 deletions api.planx.uk/modules/file/service/uploadFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const uploadPublicFile = async (
const fileUrl = buildFileUrl(key, "public");

return {
file_type: fileType,
fileType,
fileUrl,
};
};
Expand All @@ -38,7 +38,7 @@ export const uploadPrivateFile = async (
const fileUrl = buildFileUrl(key, "private");

return {
file_type: fileType,
fileType,
fileUrl,
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe("Modal trigger", () => {
);
const mockedPost = mockedAxios.post.mockResolvedValue({
data: {
file_type: "image/png",
fileType: "image/png",
fileUrl: "https://api.editor.planx.dev/file/private/gws7l5d1/test.jpg",
},
});
Expand Down Expand Up @@ -236,14 +236,14 @@ describe("Modal trigger", () => {
const mockedPost = mockedAxios.post
.mockResolvedValueOnce({
data: {
file_type: "image/png",
fileType: "image/png",
fileUrl:
"https://api.editor.planx.dev/file/private/gws7l5d1/test1.jpg",
},
})
.mockResolvedValueOnce({
data: {
file_type: "image/png",
fileType: "image/png",
fileUrl:
"https://api.editor.planx.dev/file/private/gws7l5d1/test2.jpg",
},
Expand Down Expand Up @@ -282,14 +282,14 @@ describe("Modal trigger", () => {
mockedAxios.post
.mockResolvedValueOnce({
data: {
file_type: "image/png",
fileType: "image/png",
fileUrl:
"https://api.editor.planx.dev/file/private/gws7l5d1/test1.jpg",
},
})
.mockResolvedValueOnce({
data: {
file_type: "image/png",
fileType: "image/png",
fileUrl:
"https://api.editor.planx.dev/file/private/gws7l5d1/test2.jpg",
},
Expand Down Expand Up @@ -343,7 +343,7 @@ describe("Adding tags and syncing state", () => {
// Upload one file
mockedAxios.post.mockResolvedValueOnce({
data: {
file_type: "image/png",
fileType: "image/png",
fileUrl: "https://api.editor.planx.dev/file/private/gws7l5d1/test1.jpg",
},
});
Expand Down Expand Up @@ -406,7 +406,7 @@ describe("Adding tags and syncing state", () => {
// Upload one file
mockedAxios.post.mockResolvedValueOnce({
data: {
file_type: "image/png",
fileType: "image/png",
fileUrl: "https://api.editor.planx.dev/file/private/gws7l5d1/test1.jpg",
},
});
Expand Down Expand Up @@ -472,7 +472,7 @@ describe("Error handling", () => {

mockedAxios.post.mockResolvedValueOnce({
data: {
file_type: "image/png",
fileType: "image/png",
fileUrl: "https://api.editor.planx.dev/file/private/gws7l5d1/test.png",
},
});
Expand Down Expand Up @@ -524,7 +524,7 @@ describe("Error handling", () => {

mockedAxios.post.mockResolvedValue({
data: {
file_type: "image/png",
fileType: "image/png",
fileUrl: "https://api.editor.planx.dev/file/private/gws7l5d1/test.jpg",
},
});
Expand Down Expand Up @@ -565,7 +565,7 @@ describe("Error handling", () => {

mockedAxios.post.mockResolvedValue({
data: {
file_type: "image/png",
fileType: "image/png",
fileUrl: "https://api.editor.planx.dev/file/private/gws7l5d1/test.jpg",
},
});
Expand Down

0 comments on commit b7017e2

Please sign in to comment.