Intoduce vitest
This commit is contained in:
1626
frontend/package-lock.json
generated
1626
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,9 @@
|
|||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "next lint",
|
||||||
|
"test": "vitest",
|
||||||
|
"coverage": "vitest run --coverage"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nextui-org/react": "^2.2.9",
|
"@nextui-org/react": "^2.2.9",
|
||||||
@@ -34,5 +36,9 @@
|
|||||||
"tailwind-variants": "^0.1.18",
|
"tailwind-variants": "^0.1.18",
|
||||||
"tailwindcss": "3.3.5",
|
"tailwindcss": "3.3.5",
|
||||||
"typescript": "5.0.4"
|
"typescript": "5.0.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitest/coverage-v8": "^1.6.0",
|
||||||
|
"vitest": "^1.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,23 @@ type Props = {
|
|||||||
messages: CaseMessages,
|
messages: CaseMessages,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function isImg(attachmentFile: AttachmentType) {
|
||||||
|
let path = attachmentFile.path;
|
||||||
|
let extension = path.substring(path.lastIndexOf(".") + 1).toLowerCase();
|
||||||
|
if (
|
||||||
|
extension === "png" ||
|
||||||
|
extension === "jpg" ||
|
||||||
|
extension === "jpeg" ||
|
||||||
|
extension === "gif" ||
|
||||||
|
extension === "bmp" ||
|
||||||
|
extension === "svg"
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default function CaseAttachmentsEditor({
|
export default function CaseAttachmentsEditor({
|
||||||
attachments = [],
|
attachments = [],
|
||||||
onAttachmentDownload,
|
onAttachmentDownload,
|
||||||
@@ -22,16 +39,8 @@ export default function CaseAttachmentsEditor({
|
|||||||
let others = [];
|
let others = [];
|
||||||
|
|
||||||
attachments.forEach((attachment) => {
|
attachments.forEach((attachment) => {
|
||||||
let path = attachment.path;
|
const isImage = isImg(attachment)
|
||||||
let extension = path.substring(path.lastIndexOf(".") + 1).toLowerCase();
|
if (isImage) {
|
||||||
if (
|
|
||||||
extension === "png" ||
|
|
||||||
extension === "jpg" ||
|
|
||||||
extension === "jpeg" ||
|
|
||||||
extension === "gif" ||
|
|
||||||
extension === "bmp" ||
|
|
||||||
extension === "svg"
|
|
||||||
) {
|
|
||||||
images.push(attachment);
|
images.push(attachment);
|
||||||
} else {
|
} else {
|
||||||
others.push(attachment);
|
others.push(attachment);
|
||||||
|
|||||||
Reference in New Issue
Block a user