Skip to content

A lightweight Clip Studio Paint alternative with real-time multiplayer collaborative drawing. Built with Tauri and React.

7.5 KB
Raw Blame
import { describe, it, expect } from 'vitest';
import {
  getChangelogEntries,
  getChangelogForVersion,
  hasStructuredChangelogMarkdown,
  parseChangelog,
  parseChangelogSections,
} from '../changelog';

describe('changelog parser', () => {
  it('parses bundled CHANGELOG.md including v1.2.2, v1.2.1, v1.2.0, v1.1.0, v1.0.4, v1.0.3, v1.0.2, and v1.0.1 sections', () => {
    const entries = getChangelogEntries();
    expect(entries.length).toBeGreaterThanOrEqual(8);

    const latest = getChangelogForVersion();
    expect(latest?.version).toBe('1.2.2');

    const v122 = getChangelogForVersion('1.2.2');
    expect(v122).toBeDefined();
    expect(v122?.version).toBe('1.2.2');
    expect(v122?.sections.map((s) => s.title)).toEqual(['Improvements']);
    expect(v122?.sections[0].items).toContain(
      "Rebuilt the pigment color mixing engine from scratch with Ink Studio's own spectral paint model across brushes, Natural Paint bristles, Smudge, Blur, Gradients, and the GPU compositor"
    );

    const v121 = getChangelogForVersion('1.2.1');
    expect(v121).toBeDefined();
    expect(v121?.version).toBe('1.2.1');
    expect(v121?.sections.map((s) => s.title)).toEqual([
      'New',
      'Improvements',
      'Bug Fixes',
    ]);
    expect(v121?.sections[0].items).toContain(
      'Added 36 new built-in artist brushes across every category'
    );
    expect(v121?.sections[0].items).toContain(
      'Added an upgraded Time-lapse Studio with a live in-app preview player so you can watch your time-lapse at `15s`, `30s`, `60s`, `2m`, `Full`, or a custom length right inside the app before exporting'
    );
    expect(v121?.sections[0].items).toContain(
      'Renamed the `Sub View` panel to `References` and upgraded it with a PureRef-style Board mode so you can place, view, zoom, pan, rotate, and flip multiple reference images in one space'
    );
    expect(v121?.sections[1].items).toContain(
      'Time-lapse recordings are no longer stored inside `.ink` project files'
    );
    expect(v121?.sections[2].items).toContain(
      'Fixed 1-bit black-and-white manga `.psd` files opening tinted red instead of black and white'
    );

    const v120 = getChangelogForVersion('1.2.0');
    expect(v120).toBeDefined();
    expect(v120?.version).toBe('1.2.0');
    expect(v120?.sections.map((s) => s.title)).toEqual([
      'New',
      'Improvements',
      'Bug Fixes',
    ]);
    expect(v120?.sections[0].items).toContain(
      'Added a live, non-blocking Appearance Studio drawer (accessible from the top bar, `Window` -> `Appearance Studio`, or `Preferences` -> `Appearance`)'
    );
    expect(v120?.sections[0].items).toContain(
      'Added `.inktheme` file import/export and 1-click Copy / Paste Theme Code for sharing custom themes'
    );
    expect(v120?.sections[0].items).toContain(
      'Added a Bottom Dock beneath the canvas so you can dock one or more panels side-by-side under your artwork'
    );
    expect(v120?.sections[1].items).toContain(
      'Reworked the entire UI (panels, docks, floating windows, menus, overlays, and modals)'
    );
    expect(v120?.sections[2].items).toContain(
      'Fixed accidental strokes painting on the canvas when dragging palette tabs, floating windows, resize borders, sliders, or scrollbars across the canvas with a pen tablet or pen display'
    );

    const v110 = getChangelogForVersion('1.1.0');
    expect(v110).toBeDefined();
    expect(v110?.version).toBe('1.1.0');
    expect(v110?.sections.map((s) => s.title)).toEqual([
      'New',
      'Improvements',
      'Bug Fixes',
    ]);
    expect(v110?.sections[0].items).toContain(
      'Added an Interface Size setting (60%–200%) in Preferences -> Appearance to make menus and panels smaller or larger'
    );
    expect(v110?.sections[0].items).toContain(
      'Added a "This brush rotates" checkbox in Brush Tip settings and Brush Studio so you can easily turn cursor rotation on or off for any brush'
    );
    expect(v110?.sections[0].items).toContain(
      'Added an interactive Color | B/W Split View in the Navigator (`Alt+Shift+Y`)'
    );
    expect(v110?.sections[1].items).toContain(
      'Time-lapse recordings are now saved directly inside `.ink` files and automatically resume right where you left off when you reopen your artwork'
    );
    expect(v110?.sections[2].items).toContain(
      'Fixed Natural Paint brushes not drawing properly inside regular Lasso and other active selections'
    );

    const v104 = getChangelogForVersion('1.0.4');
    expect(v104).toBeDefined();
    expect(v104?.version).toBe('1.0.4');
    expect(v104?.sections.map((s) => s.title)).toEqual([
      'New',
      'Improvements',
      'Bug Fixes',
    ]);
    expect(v104?.sections[0].items).toContain(
      'Added full Dual Brush support'
    );
    expect(v104?.sections[1].items).toContain(
      'Improved paper texture effects and brush color mixing to feel closer to Clip Studio Paint'
    );
    expect(v104?.sections[2].items).toContain(
      'Fixed ghost strokes briefly reappearing on the canvas when drawing right after pressing `Ctrl+Z`'
    );

    const v103 = getChangelogForVersion('1.0.3');
    expect(v103).toBeDefined();
    expect(v103?.version).toBe('1.0.3');
    expect(v103?.sections.map((s) => s.title)).toEqual([
      'New',
      'Improvements',
      'Bug Fixes',
    ]);
    expect(v103?.sections[0].items).toContain(
      'Added live render engine indicator and one-click memory purge button to the Info Panel'
    );
    expect(v103?.sections[1].items).toContain(
      'Extra fix for importing brushes in the `.sut` extension'
    );
    expect(v103?.sections[2].items).toContain(
      'Fixed `fillLayerSolidColor` failing'
    );

    const v102 = getChangelogForVersion('1.0.2');
    expect(v102).toBeDefined();
    expect(v102?.version).toBe('1.0.2');
    expect(v102?.sections.map((s) => s.title)).toEqual([
      'New',
      'Improvements',
      'Bug Fixes',
    ]);
    expect(v102?.sections[0].items).toContain(
      'Added Auto-Reconnect, Roles, and Access Rights in the Collaborative Room'
    );
    expect(v102?.sections[2].items).toContain(
      'Fixed bug with hand cursor stays on while drawing'
    );

    const v101 = getChangelogForVersion('1.0.1');
    expect(v101).toBeDefined();
    expect(v101?.version).toBe('1.0.1');

    const sectionTitles = v101?.sections.map((s) => s.title);
    expect(sectionTitles).toEqual(['New', 'Improvements', 'Bug Fixes', 'Other']);
    expect(v101?.sections[0].items).toContain('Added Multi-layer Liquify');
    expect(v101?.sections[3].items).toContain('Removed the "Old Vintage" theme');
  });

  it('handles v-prefixed lookup and plain-line items without bullets', () => {
    const sample = `
# Changelog

## [v1.2.3] - 2026-12-01
### New
Added something cool
- Added bullet item
`;
    const parsed = parseChangelog(sample);
    expect(parsed).toHaveLength(1);
    expect(parsed[0].version).toBe('1.2.3');
    expect(parsed[0].sections[0].items).toEqual([
      'Added something cool',
      'Added bullet item',
    ]);
  });

  it('parses standalone release notes bodies for the updater modal', () => {
    const notes = `### New
- Added brush import (\`.inkb\`)

### Bug Fixes
- Fixed micro-freezes`;

    expect(hasStructuredChangelogMarkdown(notes)).toBe(true);
    expect(hasStructuredChangelogMarkdown('Bug fixes and performance improvements.')).toBe(false);

    const sections = parseChangelogSections(notes);
    expect(sections).toEqual([
      { title: 'New', items: ['Added brush import (`.inkb`)'] },
      { title: 'Bug Fixes', items: ['Fixed micro-freezes'] },
    ]);
  });
});