From b6df1de66819f0b3bc7fdd67542d39b8b99de337 Mon Sep 17 00:00:00 2001 From: Jan Dvorak Date: Wed, 23 Aug 2023 11:43:22 +0200 Subject: [PATCH] All tests async --- CONTRIBUTING.md | 11 +++++++++++ README.md | 14 +------------- migrations_tests.js | 22 +++++++++++----------- 3 files changed, 23 insertions(+), 24 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9d7eccf --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,11 @@ +# Contributing + +1. Write some code. +2. Write some tests. +3. From this package's local directory, start the test runner: + + ``` + $ meteor test-packages ./ + ``` + +4. Open http://localhost:3000/ in your browser to see the test results. diff --git a/README.md b/README.md index ff805cd..afceb1a 100644 --- a/README.md +++ b/README.md @@ -205,25 +205,13 @@ Migrations.add({ }); ``` -* Note: You may want to to call migration after startup in case your host (such as Heroku) limits the amount of time given for startup +* Note: You may want to call migration after startup in case your host (such as Heroku) limits the amount of time given for startup ``` javascript Meteor.startup(function() { setTimetout("Migrations.migrateTo('latest')", 0); }); ``` -## Contributing - -1. Write some code. -2. Write some tests. -3. From this package's local directory, start the test runner: - - ``` - $ meteor test-packages ./ - ``` - -4. Open http://localhost:3000/ in your browser to see the test results. - ## License diff --git a/migrations_tests.js b/migrations_tests.js index d8c70d5..c5ad8af 100644 --- a/migrations_tests.js +++ b/migrations_tests.js @@ -1,7 +1,7 @@ /* global Tinytest */ import { Migrations } from './migrations_server' -Tinytest.add('Migrates up once and only once.', async function(test) { +Tinytest.addAsync('Migrates up once and only once.', async function(test) { const run = []; //keeps track of migrations in here await Migrations._reset(); @@ -24,7 +24,7 @@ Tinytest.add('Migrates up once and only once.', async function(test) { test.equal(Migrations.getVersion(), 1); }); -Tinytest.add('Migrates up once and back down.', async function(test) { +Tinytest.addAsync('Migrates up once and back down.', async function(test) { const run = []; //keeps track of migrations in here await Migrations._reset(); @@ -49,7 +49,7 @@ Tinytest.add('Migrates up once and back down.', async function(test) { test.equal(await Migrations.getVersion(), 0); }); -Tinytest.add('Migrates up several times.', async function(test) { +Tinytest.addAsync('Migrates up several times.', async function(test) { const run = []; //keeps track of migrations in here await Migrations._reset(); @@ -86,7 +86,7 @@ Tinytest.add('Migrates up several times.', async function(test) { test.equal(await Migrations.getVersion(), 4); }); -Tinytest.add('Tests migrating down', async function(test) { +Tinytest.addAsync('Tests migrating down', async function(test) { const run = []; //keeps track of migrations in here await Migrations._reset(); @@ -132,7 +132,7 @@ Tinytest.add('Tests migrating down', async function(test) { test.equal(await Migrations.getVersion(), 2); }); -Tinytest.add('Tests migrating down to version 0', async function(test) { +Tinytest.addAsync('Tests migrating down to version 0', async function(test) { const run = []; //keeps track of migrations in here await Migrations._reset(); @@ -159,7 +159,7 @@ Tinytest.add('Tests migrating down to version 0', async function(test) { test.equal(await Migrations.getVersion(), 0); }); -Tinytest.add('Checks that locking works correctly', async function(test) { +Tinytest.addAsync('Checks that locking works correctly', async function(test) { const run = []; //keeps track of migrations in here await Migrations._reset(); @@ -181,7 +181,7 @@ Tinytest.add('Checks that locking works correctly', async function(test) { test.equal(await Migrations.getVersion(), 1); }); -Tinytest.add('Checks that version is updated if subsequent migration fails', async function(test) { +Tinytest.addAsync('Checks that version is updated if subsequent migration fails', async function(test) { const run = []; let shouldError = true; await Migrations._reset(); @@ -218,7 +218,7 @@ Tinytest.add('Checks that version is updated if subsequent migration fails', asy test.equal(await Migrations.getVersion(), 2); }); -Tinytest.add('Does nothing for no migrations.', async function(test) { +Tinytest.addAsync('Does nothing for no migrations.', async function(test) { await Migrations._reset(); // shouldnt do anything @@ -226,7 +226,7 @@ Tinytest.add('Does nothing for no migrations.', async function(test) { test.equal(await Migrations.getVersion(), 0); }); -Tinytest.add('Checks that rerun works correctly', async function(test) { +Tinytest.addAsync('Checks that rerun works correctly', async function(test) { const run = []; //keeps track of migrations in here await Migrations._reset(); @@ -253,7 +253,7 @@ Tinytest.add('Checks that rerun works correctly', async function(test) { test.equal(await Migrations.getVersion(), 1); }); -Tinytest.add( +Tinytest.addAsync( 'Checks that rerun works even if there are missing versions', async function(test) { const run = []; //keeps track of migrations in here @@ -283,7 +283,7 @@ Tinytest.add( }, ); -Tinytest.add( +Tinytest.addAsync( 'Migration callbacks include the migration as an argument', async function(test) { let contextArg;