Skip to content

Commit

Permalink
🧪 test(utils): 用test包装测试用例。
Browse files Browse the repository at this point in the history
  • Loading branch information
ruan-cat committed Dec 30, 2024
1 parent eb21028 commit 58a746c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/utils/src/tests/mall-apifox-port/simple-axios.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test } from "vitest";
import axios from "axios";

/**
Expand Down Expand Up @@ -25,16 +26,12 @@ function createAxiosInstance() {
return instance;
}

function main() {
async function main() {
const instance = createAxiosInstance();
instance
.get("/home/category/head")
.then((res) => {
console.log(" ? ", res.data);
})
.catch((error) => {
console.error("Request failed", error);
});
return instance.get("/home/category/head");
}

main();
test(`测试axios在node环境内的请求`, async () => {
const res = await main();
console.log(res.data);
});

0 comments on commit 58a746c

Please sign in to comment.