Skip to content

fix: createTile silently drops pinned/savedForLater/reactions + add tile-validation tests#11

Open
cobyfrombrooklyn-bot wants to merge 1 commit intomainfrom
improvement/tile-validation-tests-and-createtile-fix
Open

fix: createTile silently drops pinned/savedForLater/reactions + add tile-validation tests#11
cobyfrombrooklyn-bot wants to merge 1 commit intomainfrom
improvement/tile-validation-tests-and-createtile-fix

Conversation

@cobyfrombrooklyn-bot
Copy link
Copy Markdown
Collaborator

Bug Fix

createTile() in db.ts accepted pinned, savedForLater, and reactions in its TypeScript type signature, but the SQL INSERT only wrote id, type, content, source, tags. This meant:

  • Creating a tile with pinned: true → tile appears unpinned
  • Creating a tile with savedForLater: true → tile appears in main feed
  • Creating a tile with reactions → reactions lost

Fix: Added pinned, saved_for_later, and reactions to the INSERT statement.

Tests

Added 25 unit tests for tile-validation.ts covering:

  • All tile types (note, song, digest, brief, article, quote, todo)
  • Edge cases (null, empty string, invalid year, non-array items, bad audio paths)
  • Unknown and flexible types
  • Helper functions (getRequiredFields, getAllRequiredFields)
  • Immutability of returned config

Also added vitest as a dev dependency and test/test:watch npm scripts.

The createTile SQL INSERT was only inserting id, type, content, source,
and tags — silently dropping pinned, savedForLater, and reactions even
though the TypeScript type accepted them.

Also adds vitest and 25 comprehensive tests for tile-validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant