SingleValueAccumulator.js 1.2 KB

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