Skip to content
This repository
Browse code

Added CustomerProspectRelation test

  • Loading branch information...
commit 53d6b7a9a74aa6926166f7fa947194c7867eaf06 1 parent 6bf09a4
Mike O'Donnell authored March 21, 2013
92  node-datasource/test/vows/models/customer_prospect_relation.js
... ...
@@ -0,0 +1,92 @@
  1
+/*jshint trailing:true, white:true, indent:2, strict:true, curly:true,
  2
+  immed:true, eqeqeq:true, forin:true, latedef:true,
  3
+  newcap:true, noarg:true, undef:true */
  4
+/*global XT:true, XM:true, XV:true, process:true, module:true, require:true */
  5
+
  6
+var XVOWS = XVOWS || {};
  7
+(function () {
  8
+  "use strict";
  9
+
  10
+  var vows = require("vows"),
  11
+    assert = require("assert"),
  12
+    zombieAuth = require("../lib/zombie_auth"),
  13
+    crud = require('../lib/crud');
  14
+
  15
+  var data = {};
  16
+
  17
+  data.createHash = {
  18
+    number: "TESTCUSTPROSP",
  19
+    name: "A test CustomerProspectRelation"
  20
+  };
  21
+
  22
+  data.updateHash = {
  23
+    number: "UPDATECUSTPROSP"
  24
+  };
  25
+
  26
+  vows.describe('XM.CustomerProspectRelation CRUD test').addBatch({
  27
+    'We can INITIALIZE a CustomerProspectRelation Model': {
  28
+      topic: function () {
  29
+        var that = this,
  30
+          callback = function () {
  31
+            data.model = new XM.CustomerProspectRelation();
  32
+            that.callback(null, data);
  33
+          };
  34
+        zombieAuth.loadApp(callback);
  35
+      },
  36
+      'The record type is XM.CustomerProspectRelation': function (data) {
  37
+        assert.equal(data.model.recordType, "XM.CustomerProspectRelation");
  38
+      }
  39
+    }
  40
+  }).addBatch({
  41
+    'We can FETCH a CustomerProspectRelation Model with a customer': {
  42
+      topic: function () {
  43
+        var fetchOptions = {},
  44
+          that = this;
  45
+        fetchOptions.id = 97;
  46
+        fetchOptions.success = function () {
  47
+          that.callback(null, data);
  48
+        };
  49
+        fetchOptions.error = function () {
  50
+          that.callback("Error fetching the relation.  Please use an actual CustomerID");
  51
+        };
  52
+        data.model.fetch(fetchOptions);
  53
+      },
  54
+      'Verify the Last Error is null': function (data) {
  55
+        assert.isNull(data.model.lastError);
  56
+      }
  57
+    }
  58
+  }).addBatch({
  59
+    'We can FETCH a CustomerProspectRelation Model with a prospect': {
  60
+      topic: function () {
  61
+        var fetchOptions = {},
  62
+          that = this;
  63
+        fetchOptions.id = 98;
  64
+        data.model = new XM.CustomerProspectRelation();
  65
+        fetchOptions.success = function () {
  66
+          that.callback(null, data);
  67
+        };
  68
+        fetchOptions.error = function () {
  69
+          that.callback("Error fetching the relation.  Please use an actual Prospect ID");
  70
+        };
  71
+        data.model.fetch(fetchOptions);
  72
+      },
  73
+      'Verify the Last Error is null': function (data) {
  74
+        assert.isNull(data.model.lastError);
  75
+      }
  76
+    }
  77
+  }).addBatch({
  78
+    'We can READ an Account Model': {
  79
+      topic: function () {
  80
+        return data;
  81
+      },
  82
+      'Make sure the model attributes are not null/undefined': function (data) {
  83
+        assert.isNotNull(data.model.get('id'));
  84
+        assert.notEqual(data.model.get('id'), undefined);
  85
+      },
  86
+      'Verify the Last Error is null': function (data) {
  87
+        assert.isNull(data.model.lastError);
  88
+      }
  89
+    }
  90
+  }).export(module);
  91
+  
  92
+}());

0 notes on commit 53d6b7a

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