Skip to content

Commit

Permalink
chore: vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
nemo-shen committed Jan 2, 2024
1 parent e27bc26 commit fbd4f2e
Show file tree
Hide file tree
Showing 5 changed files with 449 additions and 5 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest"
},
"dependencies": {
"@noi/core": "workspace:*",
Expand All @@ -18,6 +19,7 @@
"devDependencies": {
"@types/node": "^20.10.6",
"@vitejs/plugin-vue": "^4.5.2",
"vite": "^5.0.8"
"vite": "^5.0.8",
"vitest": "^1.1.1"
}
}
9 changes: 9 additions & 0 deletions packages/core/useToast/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { expect, test } from "vitest";
import { useToast } from "@noi/core";
import { ref } from 'vue'

test("should be call", () => {
const source = ref([])
const { open } = useToast(source)
expect(open).toBeTypeOf('function')
});
8 changes: 6 additions & 2 deletions packages/core/useToast/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
interface UseToastOptions {
duration: number;
duration?: number;
}
interface OpenOptions {
message: string;
}
export const useToast = (source, options: UseToastOptions) => {
export const useToast = (source, options: UseToastOptions = {}) => {
const close = () => {

}
Expand All @@ -17,3 +17,7 @@ export const useToast = (source, options: UseToastOptions) => {

}
}

export function sum(a, b) {
return a + b;
}
Loading

0 comments on commit fbd4f2e

Please sign in to comment.