Skip to content

Commit

Permalink
Fixed unit tests to handle PN tags interpretation as union between ob…
Browse files Browse the repository at this point in the history
…ject and string
  • Loading branch information
PantelisGeorgiadis committed Mar 7, 2024
1 parent 2b3e7c4 commit 78fd31e
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 49 deletions.
72 changes: 36 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dcmjs-dimse",
"version": "0.1.26",
"version": "0.1.27",
"description": "DICOM DIMSE implementation for Node.js using dcmjs",
"main": "build/dcmjs-dimse.min.js",
"module": "build/dcmjs-dimse.min.js",
Expand Down Expand Up @@ -44,14 +44,14 @@
"homepage": "https://github.com/PantelisGeorgiadis/dcmjs-dimse",
"dependencies": {
"async-eventemitter": "^0.2.4",
"dcmjs": "0.29.10",
"dcmjs": "^0.30.3",
"smart-buffer": "^4.2.0",
"ts-mixer": "^6.0.4",
"winston": "^3.11.0"
"winston": "^3.12.0"
},
"devDependencies": {
"@types/async-eventemitter": "^0.2.4",
"@types/node": "^20.11.20",
"@types/node": "^20.11.25",
"c8": "^9.1.0",
"chai": "^4.3.10",
"docdash": "^2.0.2",
Expand All @@ -67,7 +67,7 @@
"terser-webpack-plugin": "^5.3.10",
"ts-node": "^10.9.2",
"tsd": "^0.30.7",
"typescript": "^5.3.3",
"typescript": "^5.4.2",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4"
}
Expand Down
2 changes: 1 addition & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = '0.1.26';
module.exports = '0.1.27';
6 changes: 3 additions & 3 deletions test/Dataset.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('Dataset', () => {
const dicomDataset1 = dataset1.getDenaturalizedDataset();

const dataset2 = new Dataset(dicomDataset1, TransferSyntax.ImplicitVRLittleEndian);
expect(dataset2.getElement('PatientName')).to.be.eq(patientName);
expect(String(dataset2.getElement('PatientName'))).to.be.eq(patientName);
expect(dataset2.getElement('PatientID')).to.be.eq(patientID);
expect(dataset2.getElement('AccessionNumber')).to.be.eq(accessionNumber);
expect(dataset2.getElement('StudyDescription')).to.be.eq(studyDescription);
Expand All @@ -37,7 +37,7 @@ describe('Dataset', () => {
const dicomDataset2 = dataset2.getDenaturalizedDataset();

const dataset3 = new Dataset(dicomDataset2, TransferSyntax.ExplicitVRLittleEndian);
expect(dataset3.getElement('PatientName')).to.be.eq(patientName);
expect(String(dataset3.getElement('PatientName'))).to.be.eq(patientName);
expect(dataset3.getElement('PatientID')).to.be.eq(patientID);
expect(dataset3.getElement('AccessionNumber')).to.be.eq(accessionNumber);
expect(dataset3.getElement('StudyDescription')).to.be.eq(studyDescription);
Expand Down Expand Up @@ -108,7 +108,7 @@ describe('Dataset', () => {
Object.keys(elements3).forEach((el1) => {
const val1 = elements3[el1];
const val2 = elements4[el1];
expect(val1).to.be.eq(val2);
expect(String(val1)).to.be.eq(String(val2));
});

expect(() => {
Expand Down
16 changes: 12 additions & 4 deletions test/Network.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,9 @@ describe('Network', () => {
client.addRequest(request);
client.on('closed', () => {
expect(ret.getElement('PatientID')).to.be.eq(datasets[0].getElement('PatientID'));
expect(ret.getElement('PatientName')).to.be.eq(datasets[0].getElement('PatientName'));
expect(String(ret.getElement('PatientName'))).to.be.eq(
String(datasets[0].getElement('PatientName'))
);
server.close();
});
client.send('127.0.0.1', 2105, 'CALLINGAET', 'CALLEDAET');
Expand All @@ -508,7 +510,9 @@ describe('Network', () => {
client.addRequest(request);
client.on('closed', () => {
expect(ret.getElement('PatientID')).to.be.eq(datasets[1].getElement('PatientID'));
expect(ret.getElement('PatientName')).to.be.eq(datasets[1].getElement('PatientName'));
expect(String(ret.getElement('PatientName'))).to.be.eq(
String(datasets[1].getElement('PatientName'))
);
server.close();
});
client.send('127.0.0.1', 2106, 'CALLINGAET', 'CALLEDAET');
Expand Down Expand Up @@ -539,7 +543,9 @@ describe('Network', () => {
client.addRequest(findRequest);
client.on('closed', () => {
expect(ret.getElement('PatientID')).to.be.eq(datasets[2].getElement('PatientID'));
expect(ret.getElement('PatientName')).to.be.eq(datasets[2].getElement('PatientName'));
expect(String(ret.getElement('PatientName'))).to.be.eq(
String(datasets[2].getElement('PatientName'))
);
server.close();
});
client.send('127.0.0.1', 2107, 'CALLINGAET', 'CALLEDAET');
Expand Down Expand Up @@ -573,7 +579,9 @@ describe('Network', () => {
});
client.on('closed', () => {
expect(ret.getElement('PatientID')).to.be.eq(datasets[3].getElement('PatientID'));
expect(ret.getElement('PatientName')).to.be.eq(datasets[3].getElement('PatientName'));
expect(String(ret.getElement('PatientName'))).to.be.eq(
String(datasets[3].getElement('PatientName'))
);
expect(ret.getElement('StudyInstanceUID')).to.be.eq(
datasets[3].getElement('StudyInstanceUID')
);
Expand Down

0 comments on commit 78fd31e

Please sign in to comment.