-
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Hi Johan,
first of all: thanks for this cool package!! 👍
I have a useCase where I am creating shitloads of fixtures (they take about 10 seconds to be created) and I'd love to write ONE integrational-test, testing different subscriptions - all within ONE test.
The problem is that collecter.collect
can only be run ONCE within the testcase.
It would be so cool if we could use the syntax in synchronous style, so that we can call collecter.collect
multiple times, like so:
it('should allow to call collect multiple times', function() {
const collector = new PublicationCollector({userId: Random.id()});
collector.collect('publicationName', 'arg1', (collections) => {
console.log('arg1')
assert.equal(collections.myCollection.length, 10);
});
collector.collect('publicationName', 'arg2', (collections) => {
// NOT called right now
console.log('arg2')
assert.equal(collections.myCollection.length, 10);
});
});
or
it('should allow to call collect multiple times', function(done) {
const collector = new PublicationCollector({userId: Random.id()});
const differentArgumentValues = [
'argValue1',
'argValue2',
'argValue3',
]
_.each(differentArgumentValues, (currentArgument) => {
collector.collect('publicationName', currentArgument, (collections) => {
console.log(`testing currentArgument "${currentArgument}"`) // only gets called for the first value "argValue1"
assert.equal(collections.myCollection.length, 10);
});
})
done();
});
Any chance or trick of supporting this?
Metadata
Metadata
Assignees
Labels
No labels