Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dcc-js
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
D-PTB
DCC
Development
dcc-js
Merge requests
!5
Add tests
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Add tests
feat-jest-tests
into
master
Overview
1
Commits
50
Pipelines
42
Changes
1
Merged
Jan Loewe
requested to merge
feat-jest-tests
into
master
2 years ago
Overview
1
Commits
50
Pipelines
42
Changes
1
Expand
0
0
Merge request reports
Viewing commit
8876d1c0
Prev
Next
Show latest version
1 file
+
53
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
8876d1c0
test: add AdministrativeData SoftwareListType
· 8876d1c0
Muhammed-Ali Demir
authored
2 years ago
tests/DCC/AdministrativeData.SoftwareListType.test.ts
0 → 100644
+
53
−
0
Options
/**
* @jest-environment ./tests/XMLEnvironment.ts
* @xml ./tests/resources/example.xml
*/
import
{
select
,
toTextArr
,
toTextContentArr
}
from
"
../util
"
;
import
{
SoftwareListType
,
DCCDocument
,
SoftwareType
}
from
"
../../src
"
;
const
base
=
"
//dcc:administrativeData/dcc:dccSoftware/dcc:software
"
;
const
xpath
=
{
softwareNameContent
:
`
${
base
}
/dcc:name/dcc:content`
,
softwareRelease
:
`string(
${
base
}
/dcc:release)`
,
softwareType
:
"
string(${base}/dcc:type)
"
,
softwareDescription
:
"
${base}/dcc:description
"
,
softwareTypeId
:
"
${base}/@id
"
,
softwareTypeRefType
:
"
${base}/@refType
"
,
};
/*
TODO: DCC enthält mehrere Sprachen, dass muss für bestimmte Felder wie z.B. Name auf alle Sprachen geprüft und verglichen werden
* */
describe
(
"
DccSoftwareType
"
,
()
=>
{
let
dcc
:
DCCDocument
,
dccSoftware
:
SoftwareListType
,
software
:
SoftwareType
,
dom
;
beforeEach
(
async
()
=>
{
({
dcc
,
dom
}
=
await
xmlEnv
.
recreateEnv
());
dccSoftware
=
dcc
.
digitalCalibrationCertificate
.
administrativeData
.
dccSoftware
;
software
=
dccSoftware
.
software
[
1
];
/* TODO: evtl. nicht nur mit ersten Index testen */
});
test
(
"
should get correct software name content from XML
"
,
()
=>
{
// get expected list from example xml
const
expected
=
<
Element
[]
>
select
(
xpath
.
softwareNameContent
,
dom
);
expect
(
toTextArr
(
software
.
name
.
content
)).
toEqual
(
toTextContentArr
(
expected
));
});
test
(
"
should get correct software release version of software from XML
"
,
()
=>
{
expect
(
software
.
release
.
_text
).
toBe
(
select
(
xpath
.
softwareRelease
,
dom
));
});
test
(
"
should get correct software type of software from XML
"
,
()
=>
{
expect
(
software
.
type
.
_text
).
toBe
(
select
(
xpath
.
softwareType
,
dom
));
});
/* TODO: description testen*/
test
(
"
should get correct software reftype ...
"
,
()
=>
{
expect
(
software
.
_attr
.
refType
).
toBe
(
select
(
xpath
.
softwareTypeRefType
,
dom
));
});
test
(
"
should get correct software id ...
"
,
()
=>
{
expect
(
software
.
_attr
.
id
).
toBe
(
select
(
xpath
.
softwareTypeId
,
dom
));
});
});
Loading