Skip to content

Commit

Permalink
All tests async
Browse files Browse the repository at this point in the history
  • Loading branch information
StorytellerCZ committed Aug 23, 2023
1 parent 298f26f commit b6df1de
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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.
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions migrations_tests.js
Original file line number Diff line number Diff line change
@@ -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();

Expand All @@ -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();

Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand All @@ -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();

Expand All @@ -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();
Expand Down Expand Up @@ -218,15 +218,15 @@ 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
await Migrations.migrateTo('latest');
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();

Expand All @@ -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
Expand Down Expand Up @@ -283,7 +283,7 @@ Tinytest.add(
},
);

Tinytest.add(
Tinytest.addAsync(
'Migration callbacks include the migration as an argument',
async function(test) {
let contextArg;
Expand Down

0 comments on commit b6df1de

Please sign in to comment.