SingleValueAccumulator.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. var assert = require("assert"),
  2. SingleValueAccumulator = require("../../../../lib/pipeline/accumulators/SingleValueAccumulator");
  3. //TODO: refactor these test cases using Expression.parseOperand() or something because these could be a whole lot cleaner...
  4. module.exports = {
  5. "SingleValueAccumulator": {
  6. "constructor()": {
  7. "should not throw Error when constructing with no args": function testConstructor(){
  8. assert.doesNotThrow(function(){
  9. new SingleValueAccumulator();
  10. });
  11. },
  12. "should not throw Error when constructing with 1 arg": function testConstructor(){
  13. assert.doesNotThrow(function(){
  14. new SingleValueAccumulator(null);
  15. });
  16. },
  17. "should throw Error when constructing with > 1 arg": function testConstructor(){
  18. assert.throws(function(){
  19. new SingleValueAccumulator(null, null);
  20. });
  21. }
  22. },
  23. "#getValue()": {
  24. "should return the correct value 'foo'": function testGetValue(){
  25. var sva = new SingleValueAccumulator();
  26. sva.value = "foo";
  27. assert.equal(sva.getValue(), "foo");
  28. }
  29. }
  30. }
  31. };
  32. if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);