Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Instance tests

  • Loading branch information...
commit 88e47a2c60fb6db0f87a9509c30903aca4a35d38 1 parent 75a5b3e
mde authored
Showing with 36 additions and 2 deletions.
  1. +36 −2 test/events.js
View
38 test/events.js
@@ -72,6 +72,14 @@ tests = {
user.save(function () {});
}
+, 'emit instance beforeSave': function (next) {
+ var user = User.create(_params);
+ user.once('beforeSave', function () {
+ next();
+ });
+ user.save(function () {});
+ }
+
, 'emit static save': function (next) {
User.once('save', function (u) {
assert.ok(u instanceof User);
@@ -81,6 +89,14 @@ tests = {
user.save(function () {});
}
+, 'emit instance save': function (next) {
+ var user = User.create(_params);
+ user.once('save', function (u) {
+ next();
+ });
+ user.save(function () {});
+ }
+
, 'emit static beforeUpdate': function (next) {
User.once('beforeUpdate', function (u) {
assert.ok(u instanceof User);
@@ -92,6 +108,16 @@ tests = {
});
}
+, 'emit instance beforeUpdate': function (next) {
+ var user = User.create(_params);
+ user.once('beforeUpdate', function (u) {
+ next();
+ });
+ user.save(function () {
+ user.save(function () {});
+ });
+ }
+
, 'emit static update': function (next) {
User.once('update', function (res) {
assert.ok(res);
@@ -103,6 +129,16 @@ tests = {
});
}
+, 'emit instance update': function (next) {
+ var user = User.create(_params);
+ user.once('update', function (res) {
+ next();
+ });
+ user.save(function () {
+ user.save(function () {});
+ });
+ }
+
, 'emit static beforeRemove': function (next) {
User.once('beforeRemove', function (res) {
assert.ok(res);
@@ -125,8 +161,6 @@ tests = {
});
}
-, 'last': function () {}
-
};
module.exports = tests;
Please sign in to comment.
Something went wrong with that request. Please try again.