Reactive pos-label and pos-description#197
Draft
jg10-mastodon-social wants to merge 8 commits intomainfrom
Draft
Reactive pos-label and pos-description#197jg10-mastodon-social wants to merge 8 commits intomainfrom
jg10-mastodon-social wants to merge 8 commits intomainfrom
Conversation
| ), | ||
| startWith(this.anyValue(...predicateUris)), | ||
| ); | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
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()]); |
Collaborator
Author
There was a problem hiding this comment.
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)));
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #175
observeAnyValue