marklogic-community / marklogic-unit-test

Automated testing for MarkLogic
https://marklogic-community.github.io/marklogic-unit-test/
Other
13 stars 25 forks source link

Testing with SJS Sample Code throws errors #117

Closed prestonmcgowan closed 1 year ago

prestonmcgowan commented 4 years ago

https://marklogic-community.github.io/marklogic-unit-test/docs/testing-with-sjs/

[javascript] JS-JAVASCRIPT: let actual = fib.getFibbed(3, 3); -- Error running JavaScript request: SyntaxError: Identifier 'actual' has already been declared
Stack Trace
At line 20 column 4:
In let actual = fib.getFibbed(3, 3);

18. // Scenario 2: start later in the sequence
19.
20. let actual = fib.getFibbed(3, 3);
21.
22. assertions.push(

The sample code provided in documentation should execute without needing to be debugged.

prestonmcgowan commented 4 years ago

Additionally, the next failure would have been locating the fibonacci.sjs file. Where can this file be located?

hansenmc commented 4 years ago

Seems like if the variable actual variable is going to be re-used, the second code block should leave out the let and just set a new value, or both of those declarations should use var instead of let.

prestonmcgowan commented 4 years ago

I think the original intent was to show two different usages, which is ok. Just the collector for the assertions should be two different variables. Otherwise the two different scenarios should be different examples.

Please don't use var. In fact, the example should be using const instead of let since the reference to the actual variable isn't changing just its contents.

rjrudin commented 1 year ago

Old docs have been replaced.