Broken character encoding on console, wrong source string
spyro2000 opened this issue · 1 comments
Hi there,
was trying to setup a first simple test case with rx-sandbox, but wasn't successful so far:
it('rx: should notify on loading events with debouncing', (fakeAsync(() => {
// GIVEN
const { cold, getMessages, e } = rxSandbox.create(true)
const mappings = { t: true, f: false }
const triggerEvents$ = cold('t...75...f-t-120-f', mappings)
const expected = e('...50...t...50...f...170...f', mappings)
// WHEN
const messages = getMessages(underTest.isLoading$)
triggerEvents$.subscribe(loadingState => underTest.setLoadingState(loadingState))
// THEN
tick(300) // <-- appearently needed for any events to be received
marbleAssert(messages).to.equal(expected)
})))
underTest.isLoading$'
is defined as follows:
(...).pipe(
distinctUntilChanged(),
debounceTime(50),
)
So basically it should just debounce booleans 50 ms if different than the last value.
But when I run the test, I got a very strange result:
Error:
"Source: ä-----"
"Expected: -...48...-ä-...177...-ḅ-----"
Maybe my test is just wrong but I don't see why Source
hasn't the value defined by me and has (as well as Expected
) strange characters like ' ä' and 'ḅ' in it.
I am using Jest 28 and rx-sandbox 2.0.4.
Thank you!
The char is not broken, it is substitued if the value is not a single-char representatble in marble diagram, i.e
rx-sandbox/spec/assert/constructObservableMarble-spec.ts
Lines 27 to 41 in d2531e2
Given above code is not actually runnable, I can't say for sure why it kicks in your codes. The easiest way is inspect the actual test message object after calling getMessages
and compare it with source observable if it emits a value cannot be represented as single marble character.