Skip to content

Reactive pos-label and pos-description#197

Draft
jg10-mastodon-social wants to merge 8 commits intomainfrom
feat/reactive-label-description
Draft

Reactive pos-label and pos-description#197
jg10-mastodon-social wants to merge 8 commits intomainfrom
feat/reactive-label-description

Conversation

@jg10-mastodon-social
Copy link
Collaborator

@jg10-mastodon-social jg10-mastodon-social commented Mar 1, 2026

Closes #175

  • Observable for anyValue, observing subject+predicates
  • Observable for description: wrapper around anyValue
  • Observable for label: wrapper around anyValue
  • Pos-label uses new observable
  • Update unit tests using pos-label: list-address-book, pos-list, pos-login, pos-make-findable, pos-resource, pos-rich-link, pos-switch, pos-user-menu
  • Pos-description uses new observable
  • Pos-value uses observeAnyValue
  • Tests have been written
    • all new code is covered by unit tests
    • the happy path of a new feature is covered by an end-to-end test
    • manual explorative tests have been performed
  • all dependencies are updated to the latest patch version at minimum
  • the CI pipeline passes
  • documentation is up-to-date
    • TSDoc style comments on important functions, properties and events
    • stories for new PodOS elements have been added to storybook
    • Readme.md files of PodOS elements have been re-generated
    • N/A architectural decisions are documented as an ADR
    • Changelogs are updated according to Keep a Changelog

),
startWith(this.anyValue(...predicateUris)),
);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit different to other observe functions because I've tried to use the stream of changes directly and avoid unnecessary calls to anyValue.

I should perhaps have implemented this through multiple commits to improve clarity, but I did attempt to follow TDD so the tests should correspond to features of this function.

const observable = thing.observeLabel();
observable.subscribe(subscriber);

expect(subscriber.mock.lastCall).toEqual([thing.label()]);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While observeLabel doesn't call label at all, it does call labelFromUri so I thought this might be a sufficient test without duplicating all of "if nothing is found in the store".

From a TDD perspective, I wrote this as a failing test before implementing

.pipe(map((value) => value ?? labelFromUri(this.uri)));

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.

Reactive pos-label and pos-description

1 participant