Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

822 B
Raw Blame
import { describe, expect, test } from "vitest";
import { validationService } from "@/components/MemoEditor/edit/services/validationService";
import { createInitialState } from "@/components/MemoEditor/edit/state";

describe("inline image editor validation", () => {
  test("blocks saving while an inline image insertion is unresolved", () => {
    const state = createInitialState();
    state.content = "memo";
    state.ui.pendingInlineImageInsertions = 1;

    expect(validationService.canSave(state)).toEqual({
      valid: false,
      reason: "editor.validation.resolve-image-uploads",
    });
  });

  test("allows saving after the insertion is resolved", () => {
    const state = createInitialState();
    state.content = "memo";

    expect(validationService.canSave(state)).toEqual({ valid: true });
  });
});