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",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
"lint": "next lint",
|
||||
"test": "vitest",
|
||||
"coverage": "vitest run --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nextui-org/react": "^2.2.9",
|
||||
@@ -34,5 +36,9 @@
|
||||
"tailwind-variants": "^0.1.18",
|
||||
"tailwindcss": "3.3.5",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitest/coverage-v8": "^1.6.0",
|
||||
"vitest": "^1.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,23 @@ type Props = {
|
||||
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({
|
||||
attachments = [],
|
||||
onAttachmentDownload,
|
||||
@@ -22,16 +39,8 @@ export default function CaseAttachmentsEditor({
|
||||
let others = [];
|
||||
|
||||
attachments.forEach((attachment) => {
|
||||
let path = attachment.path;
|
||||
let extension = path.substring(path.lastIndexOf(".") + 1).toLowerCase();
|
||||
if (
|
||||
extension === "png" ||
|
||||
extension === "jpg" ||
|
||||
extension === "jpeg" ||
|
||||
extension === "gif" ||
|
||||
extension === "bmp" ||
|
||||
extension === "svg"
|
||||
) {
|
||||
const isImage = isImg(attachment)
|
||||
if (isImage) {
|
||||
images.push(attachment);
|
||||
} else {
|
||||
others.push(attachment);
|
||||
|
||||
Reference in New Issue
Block a user