-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for the gzip functionality - VM #1730
Add tests for the gzip functionality - VM #1730
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1730 +/- ##
=========================================
+ Coverage 83.24% 83.35% +0.1%
=========================================
Files 178 178
Lines 12022 12033 +11
Branches 2952 2958 +6
=========================================
+ Hits 10008 10030 +22
+ Misses 1837 1828 -9
+ Partials 177 175 -2
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #1730 +/- ##
=========================================
+ Coverage 83.24% 83.35% +0.1%
=========================================
Files 178 178
Lines 12022 12033 +11
Branches 2952 2958 +6
=========================================
+ Hits 10008 10030 +22
+ Misses 1837 1828 -9
+ Partials 177 175 -2
Continue to review full report at Codecov.
|
@@ -30,7 +30,7 @@ function workerOnMessage(zeeWorker: Worker) { | |||
export function compress( | |||
data: string | Uint8Array, | |||
compressionLevel?: number | |||
): Promise<string> { | |||
): Promise<Uint8Array> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were lying :)
it('compresses and decompresses properly', async () => { | ||
const clearText = '42'; | ||
const gzipedData = await compress(clearText); | ||
expect(gzipedData.constructor.name).toBe('Uint8Array'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Uint8Array's instance used is the one from inside the sandbox, that's why we can't use toBeInstanceOf
like the other PR.
closing in favor of #1731 |
In this PR we fake a worker by using node's VM capability. This isn't a real worker so it may have slightly different semantics (especially the structured clone algorithm) but it might be good enough for our needs.
Please compare with #1731.