Skip to content
This repository
Browse code

more tests

  • Loading branch information...
commit 491c432348a1913e145f0a87aa05ebdc65d721de 1 parent 0b34fc7
TJ Holowaychuk authored

Showing 1 changed file with 26 additions and 0 deletions. Show diff stats Hide diff stats

  1. +26 0 test/test.migrate.js
26 test/test.migrate.js
@@ -97,11 +97,37 @@ function testNewMigrations() {
97 97 assertPets.withDogs();
98 98 set.down(function(){
99 99 assertNoPets();
  100 + testMigrationEvents();
100 101 });
101 102 });
102 103 });
103 104 }
104 105
  106 +// test events
  107 +
  108 +function testMigrationEvents() {
  109 + migrate('adjust emails', function(next){
  110 + db.pets.forEach(function(pet){
  111 + if (pet.email)
  112 + pet.email = pet.email.replace('learnboost.com', 'lb.com');
  113 + });
  114 + next();
  115 + }, function(next){
  116 + db.pets.forEach(function(pet){
  117 + if (pet.email)
  118 + pet.email = pet.email.replace('lb.com', 'learnboost.com');
  119 + });
  120 + next();
  121 + });
  122 +
  123 + set.up(function(){
  124 + db.pets[0].email.should.equal('tobi@lb.com');
  125 + set.down(function(){
  126 + assertNoPets();
  127 + });
  128 + });
  129 +}
  130 +
105 131 // helpers
106 132
107 133 function assertNoPets() {

0 comments on commit 491c432

Please sign in to comment.
Something went wrong with that request. Please try again.