~smagoun/whoopsie/whoopsie-lp1017637

« back to all changes in this revision

Viewing changes to backend/stats/static/js/d3/test/core/functor-test.js

  • Committer: Evan Dandrea
  • Date: 2012-05-09 05:53:45 UTC
  • Revision ID: evan.dandrea@canonical.com-20120509055345-z2j41tmcbf4as5uf
The backend now lives in lp:daisy and the website (errors.ubuntu.com) now lives in lp:errors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require("../env");
2
 
 
3
 
var vows = require("vows"),
4
 
    assert = require("assert");
5
 
 
6
 
var suite = vows.describe("d3.functor");
7
 
 
8
 
suite.addBatch({
9
 
  "functor": {
10
 
    topic: function() {
11
 
      return d3.functor;
12
 
    },
13
 
    "when passed a function, returns the function": function(functor) {
14
 
      function foo() {}
15
 
      assert.strictEqual(functor(foo), foo);
16
 
    },
17
 
    "when passed a non-function, returns a wrapper function": function(functor) {
18
 
      var a = {};
19
 
      assert.isNull(functor(null)());
20
 
      assert.isUndefined(functor(undefined)());
21
 
      assert.strictEqual(functor(a)(), a);
22
 
      assert.strictEqual(functor(1)(), 1);
23
 
      assert.deepEqual(functor([1])(), [1]);
24
 
    }
25
 
  }
26
 
});
27
 
 
28
 
suite.export(module);