Skip to content

Commit 674dd86

Browse files
committed
#46: Updated README
1 parent 320ed8a commit 674dd86

2 files changed

Lines changed: 40 additions & 5 deletions

File tree

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ Allows for the insertion of OpenSCAD code, prior to the assertion being tested.
268268
### `assert.openScadFunction(openScadFunction)`
269269

270270
**Returns:**
271-
272271
```javascript
273272
{
274273
'not': function() {...},
275-
'outputToBe': function(expectedOutput) {...}
274+
'outputToBe': function(expectedOutput) {...},
275+
'typeToBe': function(expectedType) {...}
276276
}
277277
```
278278

@@ -288,7 +288,8 @@ Begins an assertion or multiple assertions on an OpenSCAD function.
288288
```javascript
289289
{
290290
'not': function() {...},
291-
'outputToBe': function(expectedOutput) {...}
291+
'outputToBe': function(expectedOutput) {...},
292+
'typeToBe': function(expectedType) {...}
292293
}
293294
```
294295

@@ -301,7 +302,8 @@ Negates the expectation of the following assertion. This is used in a chain of c
301302
{
302303
'and': {
303304
'not': function() {...},
304-
'outputToBe': function(expectedOutput) {...}
305+
'outputToBe': function(expectedOutput) {...},
306+
'typeToBe': function(expectedType) {...}
305307
}
306308
}
307309
```
@@ -312,6 +314,39 @@ Performs an equality check on the returned value of an OpenSCAD function.
312314
|---|---|---|
313315
| expectedOutput | String | The expected output of the previously specified OpenSCAD function as a string. |
314316

317+
318+
### `typeToBe(expectedType)`
319+
320+
**Returns:** {
321+
```javascript
322+
{
323+
'and': {
324+
'not': function() {...},
325+
'outputToBe': function(expectedOutput) {...},
326+
'typeToBe': function(expectedType) {...}
327+
}
328+
}
329+
```
330+
331+
Performs an equality check on the type of the returned value of an OpenSCAD function. Use by asserting against the global object `OpenScadType` as seen below.
332+
333+
| Parameter | Data Type | Description |
334+
|---|---|---|
335+
| expectedType | String | The expected type of the output of the previously specified OpenSCAD function as a string. Use with `OpenScadType` to ensure correctness. |
336+
337+
```javascript
338+
OpenScadType = {
339+
BOOLEAN: 'boolean',
340+
INF: 'inf',
341+
NAN: 'nan',
342+
NUMBER: 'number',
343+
RANGE: 'range',
344+
STRING: 'string',
345+
UNDEF: 'undef',
346+
VECTOR: 'vector'
347+
}
348+
```
349+
315350
## OpenSCAD 3D Module Assertions
316351
### `assert.openScad3dModule(openScadModule)`
317352

src/UnitTestSCAD.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var TEST_RUNNER = require('./test/TestRunner');
1717
var CONFIG = {};
1818

1919
function setUpGlobals(config, testRunner) {
20-
global.OpenScadType = OpenScadType;
20+
global.OpenScadType = OpenScadType;
2121
global.ReporterRegistry = ReporterRegistry;
2222

2323
global.testSuite = function(name, options, callback) {

0 commit comments

Comments
 (0)