- expect(() => {
- const pool = new StubPoolWithIsMainMethod(
- 1,
- './tests/worker-files/cluster/testWorker.js',
- {
- errorHandler: e => console.error(e)
- }
+ expect(
+ () =>
+ new StubPoolWithIsMainMethod(
+ 1,
+ './tests/worker-files/thread/testWorker.js',
+ {
+ errorHandler: e => console.error(e)
+ }
+ )
+ ).toThrowError(new Error('Cannot start a pool from a worker!'))
+ })
+
+ it('Verify that filePath is checked', () => {
+ expect(() => new StubPoolWithIsMainMethod(1)).toThrowError(
+ new Error('Cannot start a pool from a worker!')
+ )
+ expect(() => new StubPoolWithIsMainMethod(1, '')).toThrowError(
+ new Error('Cannot start a pool from a worker!')
+ )
+ })
+
+ it('Verify that numberOfWorkers is checked', () => {
+ expect(() => new FixedThreadPool()).toThrowError(
+ new Error(
+ 'Cannot instantiate a pool without specifying the number of workers'