mirror of
https://github.com/zhangxiangliang/stock-api.git
synced 2025-02-02 14:18:44 +08:00
feat: 完善 搜索股票代码测试用例
This commit is contained in:
parent
fe07567563
commit
227390f205
@ -5,6 +5,7 @@ describe("【基础】股票代码接口", () => {
|
||||
const {
|
||||
ERROR_UNDEFINED_GET_STOCK,
|
||||
ERROR_UNDEFINED_GET_STOCKS,
|
||||
ERROR_UNDEFINED_SEARCH_STOCK,
|
||||
} = require("utils/constant");
|
||||
|
||||
it("需要获取的股票代码", async () => {
|
||||
@ -18,4 +19,10 @@ describe("【基础】股票代码接口", () => {
|
||||
.rejects
|
||||
.toThrow(new Error(ERROR_UNDEFINED_GET_STOCKS));
|
||||
});
|
||||
|
||||
it("搜索股票代码", async () => {
|
||||
await expect(Base.searchStocks("510500"))
|
||||
.rejects
|
||||
.toThrow(new Error(ERROR_UNDEFINED_SEARCH_STOCK));
|
||||
});
|
||||
});
|
||||
|
@ -15,7 +15,7 @@ describe("【网易】股票代码接口", () => {
|
||||
});
|
||||
|
||||
it("搜索股票代码", async () => {
|
||||
await expect(Netease.searchStocks(["510500"]))
|
||||
await expect(Netease.searchStocks("510500"))
|
||||
.resolves
|
||||
.toMatchObject([{ code: "SH510500", name: "500ETF" }]);
|
||||
});
|
||||
|
@ -15,7 +15,7 @@ describe("【新浪】股票代码接口", () => {
|
||||
});
|
||||
|
||||
it("搜索股票代码", async () => {
|
||||
await expect(Sina.searchStocks(["510500"]))
|
||||
await expect(Sina.searchStocks("510500"))
|
||||
.resolves
|
||||
.toMatchObject([{ code: "SZ510500", name: "---" }, { code: "SH510500", name: "500ETF" }]);
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ describe("【雪球】股票代码接口", () => {
|
||||
});
|
||||
|
||||
it("搜索股票代码", async () => {
|
||||
await expect(Xueqiu.searchStocks(["SH510500"]))
|
||||
await expect(Xueqiu.searchStocks("SH510500"))
|
||||
.resolves
|
||||
.toMatchObject([{ code: "SH510500", name: "中证500ETF" }]);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user