forked from wilk/microjob
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vladislav Botvin
committed
Oct 25, 2019
1 parent
639b53f
commit a00474e
Showing
4 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { job, stop, start } from '../src/job' | ||
|
||
beforeAll(async () => await start()) | ||
afterAll(async () => await stop()) | ||
|
||
describe('Job Shared Testing', () => { | ||
it('should mutate shared inside job', async () => { | ||
const sab = new SharedArrayBuffer(Float64Array.BYTES_PER_ELEMENT) | ||
const shared = new Float64Array(sab) | ||
shared[0] = 1 | ||
|
||
await job( | ||
() => { | ||
shared[0] = 2 | ||
}, | ||
{ shared } | ||
) | ||
|
||
expect(shared[0]).toEqual(2) | ||
}) | ||
}) |
This file contains 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
This file contains 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
This file contains 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