mirror of
https://github.com/zhangxiangliang/stock-api.git
synced 2025-01-23 14:20:23 +08:00
feat: 增加 基础股票代码转换测试用例
This commit is contained in:
parent
f19f45723a
commit
43a6f7e744
43
test/modules/base/transform.test.ts
Normal file
43
test/modules/base/transform.test.ts
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import BaseTransform from "../../../src/modules/base/transform";
|
||||||
|
|
||||||
|
describe("【基础】股票代码转换测试", () => {
|
||||||
|
it("深交所股票代码转换", async () => {
|
||||||
|
expect(() => {
|
||||||
|
new BaseTransform().SZExchangeTransform("000000");
|
||||||
|
}).toThrow(new Error("请检查股票代码是否正确"));
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
new BaseTransform().SZExchangeTransform("SZ000000");
|
||||||
|
}).toThrow(new Error("未实现深交所股票代码转换"));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("上交所股票代码转换", async () => {
|
||||||
|
expect(() => {
|
||||||
|
new BaseTransform().SHExchangeTransform("000000");
|
||||||
|
}).toThrow(new Error("请检查股票代码是否正确"));
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
new BaseTransform().SHExchangeTransform("SH000000");
|
||||||
|
}).toThrow(new Error("未实现上交所股票代码转换"));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("港交所股票代码转换", async () => {
|
||||||
|
expect(() => {
|
||||||
|
new BaseTransform().HKExchangeTransform("000000");
|
||||||
|
}).toThrow(new Error("请检查股票代码是否正确"));
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
new BaseTransform().HKExchangeTransform("HK000000");
|
||||||
|
}).toThrow(new Error("未实现港交所股票代码转换"));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("美交所股票代码转换", async () => {
|
||||||
|
expect(() => {
|
||||||
|
new BaseTransform().USExchangeTransform("000000");
|
||||||
|
}).toThrow(new Error("请检查股票代码是否正确"));
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
new BaseTransform().USExchangeTransform("US000000");
|
||||||
|
}).toThrow(new Error("未实现美交所股票代码转换"));
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user