Skip to content

Commit

Permalink
Update test names, fix qunit module
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Apr 24, 2024
1 parent 391c7b6 commit 0dfe46b
Show file tree
Hide file tree
Showing 36 changed files with 838 additions and 811 deletions.
7 changes: 4 additions & 3 deletions tests/app/dataController.test.js
Expand Up @@ -8,15 +8,16 @@ import {Geometry} from '../../src/image/geometry';
/**
* Tests for the 'app/dataController.js' file.
*/
// Do not warn if these variables were not defined before.

/* global QUnit */
QUnit.module('app');

/**
* Tests for {@link DataController} getValue.
*
* @function module:tests/app~dataController
* @function module:tests/app~datacontroller-class
*/
QUnit.test('Test DataController.', function (assert) {
QUnit.test('DataController class', function (assert) {
const dc0 = new DataController();

// ids before add
Expand Down
8 changes: 5 additions & 3 deletions tests/dicom/dicomCode.test.js
Expand Up @@ -9,8 +9,10 @@ import {getElementsFromJSONTags} from '../../src/dicom/dicomWriter';
/**
* Tests for the 'dicom/dicomCode.js' file.
*/
// Do not warn if these variables were not defined before.
/** @module tests/dicom */

/* global QUnit */
QUnit.module('dicom');

/**
* DicomCode test: translate to element and back.
Expand Down Expand Up @@ -46,9 +48,9 @@ function testCode(code, assert, testName) {
/**
* Tests for {@link DicomCode} using simple DICOM data.
*
* @function module:tests/dicom~DicomCode
* @function module:tests/dicom~dicom-code-class
*/
QUnit.test('Test dicom code.', function (assert) {
QUnit.test('DICOM code class', function (assert) {
const meaning0 = 'code0';
const code00 = new DicomCode(meaning0);
assert.equal(code00.meaning, meaning0,
Expand Down
21 changes: 10 additions & 11 deletions tests/dicom/dicomElementsWrapper.test.js
Expand Up @@ -12,18 +12,17 @@ import dwvTestSimple from '../data/dwv-test-simple.dcm';
/**
* Tests for the 'dicom/dicomElementsWrapper.js' file.
*/
/** @module tests/dicom */
// Do not warn if these variables were not defined before.

/* global QUnit */
QUnit.module('dicom');

/**
* Tests for dcmdump using simple DICOM data.
* Using remote file for CI integration.
*
* @function module:tests/dicom~dicomElementsWrapper
* @function module:tests/dicom~dicom-dump
*/
QUnit.test('Test simple DICOM wrapping.', function (assert) {
QUnit.test('DICOM dump', function (assert) {

// parse DICOM
const dicomParser = new DicomParser();
Expand Down Expand Up @@ -80,9 +79,9 @@ QUnit.test('Test simple DICOM wrapping.', function (assert) {
/**
* Tests for getDate.
*
* @function module:tests/dicom~dicomElementsWrapper
* @function module:tests/dicom~get-dicom-date
*/
QUnit.test('Test getDate.', function (assert) {
QUnit.test('Get DICOM Date', function (assert) {
const da00 = getDate(undefined);
const daTheo00 = undefined;
assert.equal(da00, daTheo00, 'test date #00');
Expand All @@ -97,11 +96,11 @@ QUnit.test('Test getDate.', function (assert) {
});

/**
* Tests for getDate.
* Tests for getTime.
*
* @function module:tests/dicom~dicomElementsWrapper
* @function module:tests/dicom~get-dicom-time
*/
QUnit.test('Test getTime.', function (assert) {
QUnit.test('Get DICOM Time', function (assert) {
const tm00 = getTime(undefined);
const tmTheo00 = undefined;
assert.equal(tm00, tmTheo00, 'test time #00');
Expand All @@ -126,9 +125,9 @@ QUnit.test('Test getTime.', function (assert) {
/**
* Tests for getDateTime.
*
* @function module:tests/dicom~dicomElementsWrapper
* @function module:tests/dicom~get-dicom-datetime
*/
QUnit.test('Test getDateTime.', function (assert) {
QUnit.test('Get DICOM datetime', function (assert) {
const dt00 = getDateTime(undefined);
const dtTheo00 = undefined;
assert.equal(dt00, dtTheo00, 'test date-time #00');
Expand Down
12 changes: 6 additions & 6 deletions tests/dicom/dicomParser.test.js
Expand Up @@ -22,7 +22,7 @@ QUnit.module('dicom');
* Tests for {@link DicomParser} using simple DICOM data.
* Using remote file for CI integration.
*
* @function module:tests/dicom~dicomParser-simple
* @function module:tests/dicom~simple-dicom-parsing
*/
QUnit.test('Simple DICOM parsing - #DWV-REQ-IO-01-001 Load DICOM file(s)',
function (assert) {
Expand Down Expand Up @@ -78,9 +78,9 @@ QUnit.test('Simple DICOM parsing - #DWV-REQ-IO-01-001 Load DICOM file(s)',
* Tests for {@link DicomParser} using sequence test DICOM data.
* Using remote file for CI integration.
*
* @function module:tests/dicom~dicomParser-sequence
* @function module:tests/dicom~dicom-sequence-parsing
*/
QUnit.test('Sequence DICOM parsing - #DWV-REQ-IO-01-001 Load DICOM file(s)',
QUnit.test('DICOM sequence parsing - #DWV-REQ-IO-01-001 Load DICOM file(s)',
function (assert) {
const buffer = b64urlToArrayBuffer(dwvTestSequence);

Expand Down Expand Up @@ -162,9 +162,9 @@ QUnit.test('Sequence DICOM parsing - #DWV-REQ-IO-01-001 Load DICOM file(s)',
/**
* Tests for {@link cleanString}.
*
* @function module:tests/dicom~cleanString
* @function module:tests/dicom~cleanstring
*/
QUnit.test('Test cleanString.', function (assert) {
QUnit.test('cleanString', function (assert) {
// undefined
assert.throws(function () {
cleanString();
Expand Down Expand Up @@ -210,7 +210,7 @@ QUnit.test('Test cleanString.', function (assert) {
* Tests for {@link DicomParser} using DICOMDIR data.
* Using remote file for CI integration.
*
* @function module:tests/dicom~dicomParserDicomDir
* @function module:tests/dicom~dicomdir-parsing
*/
QUnit.test('DICOMDIR parsing - #DWV-REQ-IO-02-004 Load DICOMDIR URL',
function (assert) {
Expand Down
7 changes: 4 additions & 3 deletions tests/dicom/dicomSegment.test.js
Expand Up @@ -16,8 +16,9 @@ import {DicomCode} from '../../src/dicom/dicomCode';
/**
* Tests for the 'dicom/dicomSegment.js' file.
*/
// Do not warn if these variables were not defined before.

/* global QUnit */
QUnit.module('dicom');

/**
* Get a dicom code from simple dicom elements.
Expand Down Expand Up @@ -79,9 +80,9 @@ function testSegment(segment, assert, testName) {
/**
* Tests for {@link MaskSegment} using simple DICOM data.
*
* @function module:tests/dicom~MaskSegment
* @function module:tests/dicom~dicom-segment-class
*/
QUnit.test('Test dicom segment.', function (assert) {
QUnit.test('DICOM segment class', function (assert) {
const number0 = 0;
const label0 = 'Segment0';
const algorithmType0 = 'MANUAL';
Expand Down
7 changes: 4 additions & 3 deletions tests/dicom/dicomSegmentFrameInfo.test.js
Expand Up @@ -9,8 +9,9 @@ import {getElementsFromJSONTags} from '../../src/dicom/dicomWriter';
/**
* Tests for the 'dicom/dicomSegmentFrameInfo.js' file.
*/
// Do not warn if these variables were not defined before.

/* global QUnit */
QUnit.module('dicom');

/**
* SegmentFrameInfo test: translate to element and back.
Expand Down Expand Up @@ -56,9 +57,9 @@ function testSegmentFrameInfo(frameInfo, assert, testName) {
/**
* Tests for {@link DicomSegmentFrameInfo} using simple DICOM data.
*
* @function module:tests/dicom~DicomSegmentFrameInfo
* @function module:tests/dicom~dicom-segment-frame-info-class
*/
QUnit.test('Test dicom segment frame info.', function (assert) {
QUnit.test('DICOM segment frame info class', function (assert) {
const dimIndex0 = [1, 1];
const imagePosPat0 = [0.5, 0.5, 0.5];
// tests only supports simple 1D arrays of objects
Expand Down
9 changes: 5 additions & 4 deletions tests/dicom/dicomTag.test.js
Expand Up @@ -8,15 +8,16 @@ import {
/**
* Tests for the 'dicom/dicomTag.js' file.
*/
// Do not warn if these variables were not defined before.

/* global QUnit */
QUnit.module('dicom');

/**
* Tests for {@link Tag}.
*
* @function module:tests/dicom~Tag
* @function module:tests/dicom~dicom-tag-class
*/
QUnit.test('Test Tag.', function (assert) {
QUnit.test('DICOM tag class', function (assert) {
// error cases
assert.throws(function () {
new Tag();
Expand Down Expand Up @@ -71,7 +72,7 @@ QUnit.test('Test Tag.', function (assert) {
*
* @function module:tests/dicom~getTagFromDictionary
*/
QUnit.test('Test getTagFromDictionary.', function (assert) {
QUnit.test('getTagFromDictionary', function (assert) {
const tag00 = getTagFromDictionary();
assert.equal(tag00, null, 'get undefined');
const tag01 = getTagFromDictionary(null);
Expand Down
4 changes: 2 additions & 2 deletions tests/gui/generic.test.js
Expand Up @@ -4,7 +4,7 @@ import {canCreateCanvas} from '../../src/gui/generic';
* Tests for the 'gui/generic.js' file.
*/
/** @module tests/gui */
// Do not warn if these variables were not defined before.

/* global QUnit */
QUnit.module('gui');

Expand All @@ -13,7 +13,7 @@ QUnit.module('gui');
*
* @function module:tests/gui~canCreateCanvas
*/
QUnit.test('Test canCreateCanvas.', function (assert) {
QUnit.test('canCreateCanvas', function (assert) {
assert.equal(canCreateCanvas(1, 1), true,
'Can create 1*1 canvas');

Expand Down
20 changes: 10 additions & 10 deletions tests/gui/layerGroup.test.js
Expand Up @@ -7,15 +7,16 @@ import {
/**
* Tests for the 'gui/LayerGroup.js' file.
*/
// Do not warn if these variables were not defined before.

/* global QUnit */
QUnit.module('gui');

/**
* Tests for {@link LayerGroup} string id.
*
* @function module:tests/gui~LayerGroup
* @function module:tests/gui~layergroup-string-id
*/
QUnit.test('Test LayerGroup string id.', function (assert) {
QUnit.test('LayerGroup string id', function (assert) {
// test #00
const theoId00 = 'layerGroupA-layer-0';
const theoDetails00 = {groupDivId: 'layerGroupA', layerId: 0};
Expand Down Expand Up @@ -44,9 +45,9 @@ QUnit.test('Test LayerGroup string id.', function (assert) {
/**
* Tests for {@link LayerGroup} creation.
*
* @function module:tests/gui~LayerGroup
* @function module:tests/gui~layergroup-creation
*/
QUnit.test('Test LayerGroup.', function (assert) {
QUnit.test('LayerGroup creation', function (assert) {
const element00 = document.createElement('div');
element00.id = 'layerGroup00';
const layerGroup00 = new LayerGroup(element00);
Expand All @@ -56,13 +57,12 @@ QUnit.test('Test LayerGroup.', function (assert) {
'new layerGroup div id');
});


/**
* Tests for {@link LayerGroup} add/remove view layer.
*
* @function module:tests/gui~LayerGroup
* @function module:tests/gui~layergroup-add-remove-view-layer
*/
QUnit.test('Test LayerGroup add/remove view layer.', function (assert) {
QUnit.test('LayerGroup add remove view layer', function (assert) {
const element00 = document.createElement('div');
element00.id = 'layerGroup00';
const layerGroup00 = new LayerGroup(element00);
Expand All @@ -87,9 +87,9 @@ QUnit.test('Test LayerGroup add/remove view layer.', function (assert) {
/**
* Tests for {@link LayerGroup} add/remove draw layer.
*
* @function module:tests/gui~LayerGroup
* @function module:tests/gui~layergroup-add-remove-draw-layer
*/
QUnit.test('Test LayerGroup add/remove draw layer.', function (assert) {
QUnit.test('LayerGroup add remove draw layer', function (assert) {
const element00 = document.createElement('div');
element00.id = 'layerGroup00';
const layerGroup00 = new LayerGroup(element00);
Expand Down
6 changes: 3 additions & 3 deletions tests/image/geometry.test.js
Expand Up @@ -8,16 +8,16 @@ import {Geometry} from '../../src/image/geometry';
* Tests for the 'image/geometry.js' file.
*/
/** @module tests/image */
// Do not warn if these variables were not defined before.

/* global QUnit */
QUnit.module('image');

/**
* Tests for {@link Geometry}.
*
* @function module:tests/image~geometry
* @function module:tests/image~geometry-class
*/
QUnit.test('Test Geometry.', function (assert) {
QUnit.test('Geometry class', function (assert) {
// case #0: simple, index and points are equal
const imgSize0 = new Size([3, 3, 2]);
const imgSpacing0 = new Spacing([1, 1, 1]);
Expand Down

0 comments on commit 0dfe46b

Please sign in to comment.