-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
73 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...rc/candlesticks/barSizeToDuration.spec.ts → ...rc/candlesticks/barSizeToDuration.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 4 additions & 9 deletions
13
...lesticks/findHighestCandlestickBy.spec.ts → ...lesticks/findHighestCandlestickBy.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,17 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { CANDLESTICKS } from "../mocks/candlesticks.js"; | ||
import { findHighestCandlestickBy } from "./findHighestCandlestickBy.js"; | ||
|
||
describe("findHighestCandlestickBy", () => { | ||
it("highest by close", () => { | ||
expect(findHighestCandlestickBy("close", CANDLESTICKS)).toEqual( | ||
CANDLESTICKS[0], | ||
); | ||
expect(findHighestCandlestickBy("close", CANDLESTICKS)).toEqual(CANDLESTICKS[0]); | ||
}); | ||
|
||
it("highest by open", () => { | ||
expect(findHighestCandlestickBy("open", CANDLESTICKS)).toEqual( | ||
CANDLESTICKS[2], | ||
); | ||
expect(findHighestCandlestickBy("open", CANDLESTICKS)).toEqual(CANDLESTICKS[2]); | ||
}); | ||
|
||
it("highest by low", () => { | ||
expect(findHighestCandlestickBy("low", CANDLESTICKS)).toEqual( | ||
CANDLESTICKS[2], | ||
); | ||
expect(findHighestCandlestickBy("low", CANDLESTICKS)).toEqual(CANDLESTICKS[2]); | ||
}); | ||
}); |
13 changes: 4 additions & 9 deletions
13
...dlesticks/findLowestCandlestickBy.spec.ts → ...dlesticks/findLowestCandlestickBy.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,17 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { CANDLESTICKS } from "../mocks/candlesticks.js"; | ||
import { findLowestCandlestickBy } from "./findLowestCandlestickBy.js"; | ||
|
||
describe("findLowestCandlestickBy", () => { | ||
it("lowest by close", () => { | ||
expect(findLowestCandlestickBy("close", CANDLESTICKS)).toEqual( | ||
CANDLESTICKS[2], | ||
); | ||
expect(findLowestCandlestickBy("close", CANDLESTICKS)).toEqual(CANDLESTICKS[2]); | ||
}); | ||
|
||
it("lowest by open", () => { | ||
expect(findLowestCandlestickBy("open", CANDLESTICKS)).toEqual( | ||
CANDLESTICKS[1], | ||
); | ||
expect(findLowestCandlestickBy("open", CANDLESTICKS)).toEqual(CANDLESTICKS[1]); | ||
}); | ||
|
||
it("lowest by low", () => { | ||
expect(findLowestCandlestickBy("low", CANDLESTICKS)).toEqual( | ||
CANDLESTICKS[0], | ||
); | ||
expect(findLowestCandlestickBy("low", CANDLESTICKS)).toEqual(CANDLESTICKS[0]); | ||
}); | ||
}); |
48 changes: 0 additions & 48 deletions
48
packages/tools/src/candlesticks/lastClosedCandleDate.spec.ts
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
packages/tools/src/candlesticks/lastClosedCandleDate.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { lastClosedCandleDate } from "./lastClosedCandleDate.js"; | ||
|
||
describe("lastClosedCandleDate", () => { | ||
it("should return the correct date for each bar size", () => { | ||
expect(lastClosedCandleDate(new Date("2023-01-21T01:00:00.000Z").getTime(), "1m")).toBe("2023-01-21T00:59:00.000Z"); | ||
}); | ||
|
||
it("should return the correct date for 1m bar size with milliseconds", () => { | ||
expect(lastClosedCandleDate(new Date("2023-01-21T01:00:00.123Z").getTime(), "1m")).toBe("2023-01-21T00:59:00.000Z"); | ||
}); | ||
|
||
it("should return the correct date for 5m bar size with milliseconds", () => { | ||
expect(lastClosedCandleDate(new Date("2023-01-21T01:00:00.123Z").getTime(), "5m")).toBe("2023-01-21T00:55:00.000Z"); | ||
}); | ||
|
||
it("should return the correct date for 15m bar size with milliseconds", () => { | ||
expect(lastClosedCandleDate(new Date("2023-01-21T01:00:00.123Z").getTime(), "15m")).toBe( | ||
"2023-01-21T00:45:00.000Z", | ||
); | ||
}); | ||
|
||
it("should return the correct date for 1h bar size with milliseconds", () => { | ||
expect(lastClosedCandleDate(new Date("2023-01-21T01:00:00.123Z").getTime(), "1h")).toBe("2023-01-21T00:00:00.000Z"); | ||
}); | ||
}); |
1 change: 1 addition & 0 deletions
1
...urrency/common/countDecimalPlaces.spec.ts → ...urrency/common/countDecimalPlaces.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...rc/currency/common/getExponentAbs.spec.ts → ...rc/currency/common/getExponentAbs.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...es/tools/src/currency/filterPrice.spec.ts → ...es/tools/src/currency/filterPrice.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...tools/src/currency/filterQuantity.spec.ts → ...tools/src/currency/filterQuantity.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 2 additions & 5 deletions
7
...ools/src/grid/calculateInvestment.spec.ts → ...ools/src/grid/calculateInvestment.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
.../tools/src/grid/isWaitingGridLine.spec.ts → .../tools/src/grid/isWaitingGridLine.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...tools/src/grid/isWaitingPriceLine.spec.ts → ...tools/src/grid/isWaitingPriceLine.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ls/src/symbolId/decomposeSymbolId.spec.ts → ...ls/src/symbolId/decomposeSymbolId.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
.../src/symbolId/isValidExchangeCode.spec.ts → .../src/symbolId/isValidExchangeCode.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
.../tools/src/symbolId/isValidSymbol.spec.ts → .../tools/src/symbolId/isValidSymbol.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ools/src/symbolId/isValidSymbolId.spec.ts → ...ools/src/symbolId/isValidSymbolId.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from "vitest/config"; | ||
|
||
export default defineConfig({ | ||
test: { | ||
globals: true, | ||
environment: "node", | ||
coverage: { | ||
reporter: ["text", "json", "html"], | ||
}, | ||
include: ["src/**/*.test.ts"], | ||
}, | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.