SingleValueAccumulator.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 1 arg": function testConstructor(){
  8. assert.doesNotThrow(function(){
  9. new SingleValueAccumulator(null);
  10. });
  11. },
  12. "should throw Error when constructing with > 1 arg": function testConstructor(){
  13. assert.throws(function(){
  14. new SingleValueAccumulator(null, null);
  15. });
  16. },
  17. "should throw Error when constructing with < 1 arg": function testConstructor(){
  18. assert.throws(function(){
  19. new SingleValueAccumulator();
  20. });
  21. }
  22. },
  23. "#getValue()": {
  24. "should return the correct value 'foo'": function testGetValue(){
  25. assert.equal(new SingleValueAccumulator("foo").getValue(), "foo");
  26. }
  27. }
  28. }
  29. };
  30. if (!module.parent)(new(require("mocha"))()).ui("exports").reporter("spec").addFile(__filename).run(process.exit);