updated util, added test

This commit is contained in:
francisco aloi
2024-12-30 20:16:35 +01:00
committed by Nicolás Hatcher Andrés
parent 5ca15033f7
commit f2757e7d76
2 changed files with 23 additions and 9 deletions

View File

@@ -1,6 +1,8 @@
import { readFile } from "node:fs/promises";
import { type SelectedView, initSync } from "@ironcalc/wasm";
import { expect, test } from "vitest";
import { decreaseDecimalPlaces, increaseDecimalPlaces } from "../formatUtil";
import { isNavigationKey } from "../util";
import { getFullRangeToString, isNavigationKey } from "../util";
test("checks arrow left is a navigation key", () => {
expect(isNavigationKey("ArrowLeft")).toBe(true);
@@ -24,3 +26,20 @@ test("decrease decimals", () => {
'dddd"," mmmm dd"," yyyy',
);
});
test("format range to get the full formula", async () => {
const buffer = await readFile("node_modules/@ironcalc/wasm/wasm_bg.wasm");
initSync(buffer);
const selectedView: SelectedView = {
sheet: 0,
row: 1,
column: 8,
range: [1, 8, 1, 8],
top_row: 1,
left_column: 8,
};
const worksheetNames = ["Sheet1", "Notes"];
expect(getFullRangeToString(selectedView, worksheetNames)).toBe("Sheet1!H1");
});