feat: 完善 搜索股票代码测试用例

This commit is contained in:
zhangxiangliang 2020-08-22 17:11:23 +08:00
parent fe07567563
commit 227390f205
4 changed files with 10 additions and 3 deletions

View File

@ -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));
});
});

View File

@ -15,7 +15,7 @@ describe("【网易】股票代码接口", () => {
});
it("搜索股票代码", async () => {
await expect(Netease.searchStocks(["510500"]))
await expect(Netease.searchStocks("510500"))
.resolves
.toMatchObject([{ code: "SH510500", name: "500ETF" }]);
});

View File

@ -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" }]);
});

View File

@ -21,7 +21,7 @@ describe("【雪球】股票代码接口", () => {
});
it("搜索股票代码", async () => {
await expect(Xueqiu.searchStocks(["SH510500"]))
await expect(Xueqiu.searchStocks("SH510500"))
.resolves
.toMatchObject([{ code: "SH510500", name: "中证500ETF" }]);
});