Fix up
This commit is contained in:
parent
fc19e650ca
commit
0f441e38d8
24 changed files with 553 additions and 68 deletions
|
|
@ -7,8 +7,7 @@ import { FileOperations } from "./file-operations";
|
|||
import { Logger } from "../tracing/logger";
|
||||
import { assertSetContainsExactly } from "../utils/assert-set-contains-exactly";
|
||||
import type { FileSystemOperations } from "./filesystem-operations";
|
||||
import fs from "fs";
|
||||
import { TextWithCursors } from "reconcile-text";
|
||||
import type { TextWithCursors } from "reconcile-text";
|
||||
|
||||
class MockDatabase implements Partial<Database> {
|
||||
public getLatestDocumentByRelativePath(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import type { Database, RelativePath } from "../persistence/database";
|
|||
import { SafeFileSystemOperations } from "./safe-filesystem-operations";
|
||||
import type { TextWithCursors } from "reconcile-text";
|
||||
import { isBinary, reconcile } from "reconcile-text";
|
||||
import { isFileTypeMergable } from "../utils/is-file-type-mergable";
|
||||
export class FileOperations {
|
||||
private static readonly PARENTHESES_REGEX = / \((\d+)\)$/;
|
||||
private readonly fs: SafeFileSystemOperations;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { FileSystemOperations } from "./filesystem-operations";
|
|||
import type { Logger } from "../tracing/logger";
|
||||
import { Locks } from "../utils/locks";
|
||||
import { FileNotFoundError } from "./file-not-found-error";
|
||||
import { TextWithCursors } from "reconcile-text";
|
||||
import type { TextWithCursors } from "reconcile-text";
|
||||
|
||||
/**
|
||||
* Decorates `FileSystemOperations` to replace errors with `FileNotFoundError`
|
||||
|
|
|
|||
|
|
@ -77,11 +77,6 @@ export class SyncClient {
|
|||
|
||||
const history = new SyncHistory(logger);
|
||||
|
||||
await initWasm(
|
||||
// eslint-disable-next-line
|
||||
(wasmBin as any).default // it is loaded as a base64 string by webpack
|
||||
);
|
||||
|
||||
let state = (await persistence.load()) ?? {
|
||||
settings: undefined,
|
||||
database: undefined
|
||||
|
|
|
|||
|
|
@ -25,4 +25,4 @@ describe("isFileTypeMergable", () => {
|
|||
expect(isFileTypeMergable("HELLO.JSON")).toBe(false);
|
||||
expect(isFileTypeMergable("my/config.yml")).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
export function isFileTypeMergable(pathOrFileName: string): boolean {
|
||||
const parts = pathOrFileName.split(".");
|
||||
const fileExtension = parts.at(-1) || "";
|
||||
const fileExtension = parts.at(-1) ?? "";
|
||||
|
||||
return ["md", "txt"].includes(fileExtension.toLowerCase());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ async function runTest({
|
|||
console.info(`Using vault name: ${vaultName}`);
|
||||
const initialSettings: Partial<SyncSettings> = {
|
||||
isSyncEnabled: true,
|
||||
token: " test-token-change-me ", // same as in backend/config-e2e.yml with spaces
|
||||
token: " test-token-change-me ", // same as in sync-server/config-e2e.yml with spaces
|
||||
vaultName: randomCasing(vaultName) + (Math.random() > 0.5 ? " " : ""), // extra spaces shouldn't matter
|
||||
syncConcurrency: concurrency,
|
||||
remoteUri: "http://localhost:3000"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue