Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
t.test('another validation initiated', assert => {
const tasks = new Map();
const firstTask = createMockTask();
const secondTask = createMockTask();
testSaga(validateSourceSaga, tasks, action)
.next()
.call(importValidations)
.next({javascript})
.fork(javascript, source, projectAttributes)
.next(firstTask)
.join(firstTask);
testSaga(validateSourceSaga, tasks, action)
.next()
.cancel(firstTask)
.next()
.call(importValidations)
.next({javascript})
.fork(javascript, source, projectAttributes)
.next(secondTask)
t.test('another validation initiated', assert => {
const tasks = new Map();
const firstTask = createMockTask();
const secondTask = createMockTask();
testSaga(validateSourceSaga, tasks, action)
.next()
.call(importValidations)
.next({javascript})
.fork(javascript, source, projectAttributes)
.next(firstTask)
.join(firstTask);
testSaga(validateSourceSaga, tasks, action)
.next()
.cancel(firstTask)
.next()
.call(importValidations)
.next({javascript})
.fork(javascript, source, projectAttributes)
t.test('validation completes', assert => {
const tasks = new Map();
const task = createMockTask();
testSaga(validateSourceSaga, tasks, action)
.next()
.call(importValidations)
.next({javascript})
.fork(javascript, source, projectAttributes)
.next(task)
.join(task)
.next(errors)
.put(validatedSource(language, errors))
.next()
.isDone();
assert.end();
});
test('should cancel autoRefresh task if it is running', () => {
const mockLoaderTask = createMockTask();
mockLoaderTask.name = 'autoRefresh';
mockLoaderTask.meta = { loader: 'test-loader' };
const startGen = dataLoaderFlow(startRefreshAction);
startGen.next();
startGen.next(mockLoaderTask);
expect(gen.next(stopRefreshAction).value).toEqual(cancel(mockLoaderTask));
});
});