Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function testCloneableGenerator3() {
function* testSaga(n1: number, n2: number, n3: number): SagaIterator {
yield put({type: 'my-action'});
}
// typings:expect-error
cloneableGenerator(testSaga)(1, 2);
cloneableGenerator(testSaga)(1, 2, 3);
}
function testCloneableGenerator1() {
function* testSaga(n1: number): SagaIterator {
yield put({type: 'my-action'});
}
// typings:expect-error
cloneableGenerator(testSaga)();
// typings:expect-error
cloneableGenerator(testSaga)('foo');
cloneableGenerator(testSaga)(1);
}
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();
});
function testCloneableGenerator5() {
function* testSaga(
n1: number,
n2: number,
n3: number,
n4: number,
n5: number,
): SagaIterator {
yield put({type: 'my-action'});
}
cloneableGenerator(testSaga)(1, 2, 3, 4, 5);
}
function testCloneableGenerator6Rest() {
function* testSaga(
n1: number,
n2: number,
n3: number,
n4: number,
n5: number,
n6: number,
n7: number,
): SagaIterator {
yield put({type: 'my-action'});
}
cloneableGenerator(testSaga)(1, 2, 3, 4, 5, 6, 7);
}
function testCloneableGenerator6() {
function* testSaga(
n1: number,
n2: number,
n3: number,
n4: number,
n5: number,
n6: number,
): SagaIterator {
yield put({type: 'my-action'});
}
cloneableGenerator(testSaga)(1, 2, 3, 4, 5, 6);
}
function testCloneableGenerator4() {
function* testSaga(
n1: number,
n2: number,
n3: number,
n4: number,
): SagaIterator {
yield put({type: 'my-action'});
}
cloneableGenerator(testSaga)(1, 2, 3, 4);
}
function testCloneableGenerator() {
function* testSaga(): SagaIterator {
yield put({type: 'my-action'});
}
const cloneableGen = cloneableGenerator(testSaga)();
const value = cloneableGen.next().value;
const clone = cloneableGen.clone();
const cloneVal = clone.next().value;
}