@simplysm/excel 13.0.70 → 13.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/excel",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.72",
|
|
4
4
|
"description": "Excel file processing library",
|
|
5
5
|
"author": "simplysm",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"mime": "^4.1.0",
|
|
23
23
|
"zod": "^4.3.6",
|
|
24
|
-
"@simplysm/core-common": "13.0.
|
|
24
|
+
"@simplysm/core-common": "13.0.72"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
2
2
|
import { ExcelWorkbook } from "../src/excel-workbook";
|
|
3
3
|
import type { Bytes } from "@simplysm/core-common";
|
|
4
4
|
|
|
@@ -157,4 +157,63 @@ describe("ExcelWorkbook", () => {
|
|
|
157
157
|
await expect(wb.getBytes()).rejects.toThrow();
|
|
158
158
|
});
|
|
159
159
|
});
|
|
160
|
+
|
|
161
|
+
describe("Reading real xlsx file", () => {
|
|
162
|
+
let wb: ExcelWorkbook;
|
|
163
|
+
|
|
164
|
+
beforeAll(async () => {
|
|
165
|
+
const url = new URL("./fixtures/초기화.xlsx", import.meta.url);
|
|
166
|
+
|
|
167
|
+
if (!("window" in globalThis)) {
|
|
168
|
+
const fs = await import("node:fs" as string);
|
|
169
|
+
const { fileURLToPath } = await import("node:url" as string);
|
|
170
|
+
const buffer = fs.readFileSync(fileURLToPath(url));
|
|
171
|
+
wb = new ExcelWorkbook(new Uint8Array(buffer));
|
|
172
|
+
} else {
|
|
173
|
+
const response = await fetch(url);
|
|
174
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
175
|
+
wb = new ExcelWorkbook(new Uint8Array(arrayBuffer));
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
afterAll(async () => {
|
|
180
|
+
await wb.close();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("Can read worksheet names", async () => {
|
|
184
|
+
const names = await wb.getWorksheetNames();
|
|
185
|
+
expect(names).toEqual(["권한그룹", "권한그룹권한", "직원"]);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it("Can read permission group sheet data", async () => {
|
|
189
|
+
const ws = await wb.getWorksheet("권한그룹");
|
|
190
|
+
const data = await ws.getDataTable();
|
|
191
|
+
expect(data).toEqual([
|
|
192
|
+
{ "ID": 1, "명칭": "관리자" },
|
|
193
|
+
]);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it("Can read permission group permission sheet data", async () => {
|
|
197
|
+
const ws = await wb.getWorksheet("권한그룹권한");
|
|
198
|
+
const data = await ws.getDataTable();
|
|
199
|
+
expect(data).toEqual([
|
|
200
|
+
{ "권한그룹.ID": 1, "코드": "ALL", "값": true },
|
|
201
|
+
]);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it("Can read employee sheet data", async () => {
|
|
205
|
+
const ws = await wb.getWorksheet("직원");
|
|
206
|
+
const data = await ws.getDataTable();
|
|
207
|
+
expect(data).toEqual([
|
|
208
|
+
{
|
|
209
|
+
"ID": 1,
|
|
210
|
+
"이름": "관리자",
|
|
211
|
+
"이메일": "admin@test.com",
|
|
212
|
+
"비밀번호": "1234",
|
|
213
|
+
"권한그룹.ID": 1,
|
|
214
|
+
"삭제": false,
|
|
215
|
+
},
|
|
216
|
+
]);
|
|
217
|
+
});
|
|
218
|
+
});
|
|
160
219
|
});
|
|
Binary file
|