test: add vitest and openai test
This commit is contained in:
parent
3d3f07c380
commit
bf887ae8fc
@ -6,6 +6,7 @@
|
||||
"dev": "nodemon",
|
||||
"start": "cross-env NODE_ENV=production node ./dist/src/server/main.js",
|
||||
"start:docker": "pnpm db:migrate:apply && pnpm db:generate && pnpm start",
|
||||
"test": "vitest",
|
||||
"build": "pnpm build:tracker && pnpm build:client && pnpm build:server && pnpm build:geo",
|
||||
"build:client": "vite build",
|
||||
"build:server": "tsc -p tsconfig.server.json",
|
||||
@ -130,6 +131,7 @@
|
||||
"tailwindcss": "^3.3.3",
|
||||
"tar": "^6.1.15",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^4.4.9"
|
||||
"vite": "^4.4.9",
|
||||
"vitest": "^1.1.3"
|
||||
}
|
||||
}
|
||||
|
738
pnpm-lock.yaml
738
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
12
src/server/model/monitor/provider/__tests__/openai.spec.ts
Normal file
12
src/server/model/monitor/provider/__tests__/openai.spec.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { describe, test } from 'vitest';
|
||||
import { getBillingCreditGrants } from '../openai';
|
||||
|
||||
describe.runIf(!!process.env.OPENAI_SESS_KEY)('openai', () => {
|
||||
test('getBillingCreditGrants should be ok', async () => {
|
||||
const res = await getBillingCreditGrants(
|
||||
String(process.env.OPENAI_SESS_KEY)
|
||||
);
|
||||
|
||||
console.log(res);
|
||||
});
|
||||
});
|
@ -53,7 +53,7 @@ export const openai: MonitorProvider<{
|
||||
},
|
||||
};
|
||||
|
||||
async function getBillingCreditGrants(sessionKey: string) {
|
||||
export async function getBillingCreditGrants(sessionKey: string) {
|
||||
const { data } = await axios.get(
|
||||
'https://api.openai.com/dashboard/billing/credit_grants',
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user