Add basic tests for decodeArrayStream#44
Merged
sergeyzenchenko merged 2 commits intomsgpack:masterfrom May 30, 2019
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #44 +/- ##
==========================================
+ Coverage 91.46% 93.59% +2.13%
==========================================
Files 14 15 +1
Lines 808 828 +20
Branches 170 173 +3
==========================================
+ Hits 739 775 +36
+ Misses 49 28 -21
- Partials 20 25 +5
Continue to review full report at Codecov.
|
gfx
reviewed
May 30, 2019
| error = e; | ||
| } | ||
|
|
||
| assert.notStrictEqual(error, null); |
Member
There was a problem hiding this comment.
you can use assert.rejects() https://nodejs.org/api/assert.html#assert_assert_rejects_asyncfn_error_message
You can find its usage in this repo.
Member
|
Thanks! BTW you can just return AsyncIterable from diff --git a/src/decodeAsync.ts b/src/decodeAsync.ts
index d4bea9e..1773eb4 100644
--- a/src/decodeAsync.ts
+++ b/src/decodeAsync.ts
@@ -19,10 +19,10 @@ export async function decodeAsync(
return decoder.decodeOneAsync(stream);
}
-export async function* decodeArrayStream(
+export function decodeArrayStream(
stream: AsyncIterable<Uint8Array | ArrayLike<number>>,
options: DecodeAsyncOptions = defaultDecodeOptions,
-) {
+): AsyncIterable<unknown> {
const decoder = new Decoder(
options.extensionCodec,
options.maxStrLength,
@@ -32,7 +32,5 @@ export async function* decodeArrayStream(
options.maxExtLength,
);
- for await (let item of decoder.decodeArrayStream(stream)) {
- yield item;
- }
+ return decoder.decodeArrayStream(stream);
} |
Collaborator
Author
Merged
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.
@gfx just few of basic tests for decodeArrayStream #42