fix chunk test for windows
This commit is contained in:
parent
69f13e65b8
commit
3ba8ef7fcb
1 changed files with 23 additions and 23 deletions
|
|
@ -1,32 +1,32 @@
|
|||
import { shouldChunk } from "../../../indexing/chunk/chunk";
|
||||
import path from "path";
|
||||
import { shouldChunk } from "../../../indexing/chunk/chunk";
|
||||
|
||||
describe("shouldChunk", () => {
|
||||
test("should chunk a typescript file", () => {
|
||||
const filePath = "directory/file.ts";
|
||||
const fileContent = generateString(10000);
|
||||
expect(shouldChunk(path.sep, filePath, fileContent)).toBe(true);
|
||||
});
|
||||
test("should chunk a typescript file", () => {
|
||||
const filePath = path.join("directory", "file.ts");
|
||||
const fileContent = generateString(10000);
|
||||
expect(shouldChunk(path.sep, filePath, fileContent)).toBe(true);
|
||||
});
|
||||
|
||||
test("should not chunk a large typescript file", () => {
|
||||
const filePath = "directory/file.ts";
|
||||
const fileContent = generateString(1500000);
|
||||
expect(shouldChunk(path.sep, filePath, fileContent)).toBe(false);
|
||||
});
|
||||
test("should not chunk a large typescript file", () => {
|
||||
const filePath = path.join("directory", "file.ts");
|
||||
const fileContent = generateString(1500000);
|
||||
expect(shouldChunk(path.sep, filePath, fileContent)).toBe(false);
|
||||
});
|
||||
|
||||
test("should not chunk an empty file", () => {
|
||||
const filePath = "directory/file.ts";
|
||||
const fileContent = generateString(0);
|
||||
expect(shouldChunk(path.sep, filePath, fileContent)).toBe(false);
|
||||
});
|
||||
test("should not chunk an empty file", () => {
|
||||
const filePath = path.join("directory", "file.ts");
|
||||
const fileContent = generateString(0);
|
||||
expect(shouldChunk(path.sep, filePath, fileContent)).toBe(false);
|
||||
});
|
||||
|
||||
test("should not chunk a file without extension", () => {
|
||||
const filePath = "directory/with.dot/filename";
|
||||
const fileContent = generateString(10000);
|
||||
expect(shouldChunk(path.sep, filePath, fileContent)).toBe(false);
|
||||
});
|
||||
test("should not chunk a file without extension", () => {
|
||||
const filePath = path.join("directory", "with.dot", "filename");
|
||||
const fileContent = generateString(10000);
|
||||
expect(shouldChunk(path.sep, filePath, fileContent)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
function generateString(length: number) {
|
||||
return "a".repeat(length);
|
||||
}
|
||||
return "a".repeat(length);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue