forked from cult-of-coders/redis-oplog
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from leonardoventurini/meteor-3.1
Meteor 3.1
- Loading branch information
Showing
11 changed files
with
129 additions
and
64 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,42 @@ | ||
function @setup-test() { | ||
local meteor_version=${1:-"3.1"} | ||
|
||
echo "🚀 Setting up test environment for Meteor ${meteor_version}" | ||
|
||
rm -rf test | ||
meteor create --release ${meteor_version} --bare test | ||
|
||
( | ||
cd test | ||
meteor npm i --save puppeteer@1.18.1 simpl-schema@3.4.6 chai@4.3.6 | ||
) | ||
} | ||
|
||
function @test() { | ||
local meteor_version=${1:-"3.1"} | ||
|
||
echo "🚀 Running tests with Meteor ${meteor_version}" | ||
|
||
( | ||
cd test | ||
METEOR_PACKAGE_DIRS="../" TEST_BROWSER_DRIVER=puppeteer meteor test-packages \ | ||
--raw-logs \ | ||
--once \ | ||
--driver-package meteortesting:mocha \ | ||
--release ${meteor_version} \ | ||
--exclude-archs=web.browser.legacy \ | ||
../ | ||
) | ||
} | ||
|
||
function @testd { | ||
( | ||
cd test | ||
METEOR_PACKAGE_DIRS="../" TEST_BROWSER_DRIVER=puppeteer meteord test-packages \ | ||
--raw-logs \ | ||
--once \ | ||
--driver-package meteortesting:mocha \ | ||
--exclude-archs=web.browser.legacy \ | ||
../ | ||
) | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
import { assert } from 'chai'; | ||
import {Mongo} from 'meteor/mongo'; | ||
import { Mongo } from 'meteor/mongo'; | ||
|
||
const InitialAddCollection = new Mongo.Collection('initial_add') | ||
const InitialAddCollection = new Mongo.Collection('initial_add'); | ||
describe('Initial Add', function () { | ||
let lastDocId; | ||
before(function () { | ||
InitialAddCollection.remove({}); | ||
for (let i = 0; i <= 10; i++) { | ||
lastDocId = InitialAddCollection.insert({number: i}) | ||
} | ||
}); | ||
let lastDocId; | ||
before(async function () { | ||
await InitialAddCollection.removeAsync({}); | ||
for (let i = 0; i <= 10; i++) { | ||
lastDocId = await InitialAddCollection.insertAsync({ number: i }); | ||
} | ||
}); | ||
|
||
it('Should not crash on initial add', function (done) { | ||
Meteor.defer(() => { | ||
let err; | ||
InitialAddCollection.find().observeChanges({ | ||
added(_id, doc) { | ||
if (err) return; | ||
Meteor._sleepForMs(10) // simulate a more costly operation | ||
try { | ||
assert.isDefined(doc) | ||
} catch (e) { | ||
err = e | ||
} | ||
} | ||
}); | ||
done(err); | ||
}); | ||
Meteor.defer(() => { | ||
InitialAddCollection.remove({_id: lastDocId}) | ||
}) | ||
}) | ||
it('Should not crash on initial add', function (done) { | ||
Meteor.defer(async () => { | ||
let err; | ||
await InitialAddCollection.find().observeChanges({ | ||
async added(_id, doc) { | ||
if (err) return; | ||
await Meteor._sleepForMs(10); // simulate a more costly operation | ||
try { | ||
assert.isDefined(doc); | ||
} catch (e) { | ||
err = e; | ||
} | ||
}, | ||
}); | ||
done(err); | ||
}); | ||
Meteor.defer(async () => { | ||
await InitialAddCollection.removeAsync({ _id: lastDocId }); | ||
}); | ||
}); | ||
}); |
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