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
Commits
676a4794
Verified
Commit
676a4794
authored
2 years ago
by
Jan Loewe
Browse files
Options
Downloads
Patches
Plain Diff
refactor(tests): small improvements and formatting
parent
590f6bc4
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!10
Refactor Test Resources
,
!6
Adaptations for new DCC V3.2.1
,
!5
Add tests
Pipeline
#18617
failed
2 years ago
Stage: .pre
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/GP_Temperature/CharsXMLList.test.ts
+2
-4
2 additions, 4 deletions
tests/GP_Temperature/CharsXMLList.test.ts
tests/GP_Temperature/noQuantity.test.ts
+13
-11
13 additions, 11 deletions
tests/GP_Temperature/noQuantity.test.ts
tests/resources/example.xml
+1
-1
1 addition, 1 deletion
tests/resources/example.xml
with
16 additions
and
16 deletions
tests/GP_Temperature/CharsXMLList.test.ts
+
2
−
4
View file @
676a4794
...
@@ -3,10 +3,8 @@
...
@@ -3,10 +3,8 @@
* @xml ./tests/resources/GP_Temperature_Complete_DCC.xml
* @xml ./tests/resources/GP_Temperature_Complete_DCC.xml
*/
*/
import
*
as
fc
from
"
fast-check
"
;
import
{
select
}
from
"
../util
"
;
import
{
indexOf
,
select
,
toTextArr
,
toTextContentArr
}
from
"
../util
"
;
import
{
DCCDocument
}
from
"
../../src
"
;
import
{
CoreDataType
,
DCCDocument
,
DCCXMLElement
}
from
"
../../src
"
;
import
{
string_ISO639_1
}
from
"
../Arbitraries
"
;
const
base
=
"
//dcc:quantity[@refType='test_charsXMLList']
"
;
const
base
=
"
//dcc:quantity[@refType='test_charsXMLList']
"
;
const
xpath
=
{
const
xpath
=
{
...
...
This diff is collapsed.
Click to expand it.
tests/GP_Temperature/noQuantity.test.ts
+
13
−
11
View file @
676a4794
...
@@ -3,23 +3,21 @@
...
@@ -3,23 +3,21 @@
* @xml ./tests/resources/GP_Temperature_Complete_DCC.xml
* @xml ./tests/resources/GP_Temperature_Complete_DCC.xml
*/
*/
import
*
as
fc
from
"
fast-check
"
;
import
{
select
}
from
"
../util
"
;
import
{
indexOf
,
select
,
toTextArr
,
toTextContentArr
}
from
"
../util
"
;
import
{
DCCDocument
}
from
"
../../src
"
;
import
{
CoreDataType
,
DCCDocument
,
DCCXMLElement
}
from
"
../../src
"
;
import
{
string_ISO639_1
}
from
"
../Arbitraries
"
;
const
base
=
"
//dcc:quantity[@refType='test_noQuantity']
"
;
const
base
=
"
//dcc:quantity[@refType='test_noQuantity']
/dcc:noQuantity
"
;
const
xpath
=
{
const
xpath
=
{
noQuantity
:
{
noQuantity
:
{
name
:
`string(
${
base
}
/dcc:
noQuantity/dcc:
name)`
,
name
:
`string(
${
base
}
/dcc:name)`
,
content
:
`string(
${
base
}
/dcc:
noQuantity/dcc:
content)`
,
content
:
`string(
${
base
}
/dcc:content)`
,
file
:
{
file
:
{
fileName
:
`string(
${
base
}
/dcc:
noQuantity/dcc:
file/dcc:fileName)`
,
fileName
:
`string(
${
base
}
/dcc:file/dcc:fileName)`
,
mimeType
:
`string(
${
base
}
/dcc:
noQuantity/dcc:
file/dcc:mimeType)`
,
mimeType
:
`string(
${
base
}
/dcc:file/dcc:mimeType)`
,
dataBase64
:
`string(
${
base
}
/dcc:
noQuantity/dcc:
file/dcc:dataBase64)`
,
dataBase64
:
`string(
${
base
}
/dcc:file/dcc:dataBase64)`
,
},
},
formula
:
{
formula
:
{
latex
:
`string(
${
base
}
/dcc:
noQuantity/dcc:
formula/dcc:latex)`
,
latex
:
`string(
${
base
}
/dcc:formula/dcc:latex)`
,
},
},
},
},
};
};
...
@@ -35,15 +33,19 @@ describe("noQuantity", () => {
...
@@ -35,15 +33,19 @@ describe("noQuantity", () => {
test
(
"
should get correct name from XML
"
,
()
=>
{
test
(
"
should get correct name from XML
"
,
()
=>
{
expect
(
result
.
data
.
quantity
[
0
].
noQuantity
.
name
.
_text
).
toBe
(
select
(
xpath
.
noQuantity
.
name
,
dom
));
expect
(
result
.
data
.
quantity
[
0
].
noQuantity
.
name
.
_text
).
toBe
(
select
(
xpath
.
noQuantity
.
name
,
dom
));
});
});
test
(
"
should get correct content from XML
"
,
()
=>
{
test
(
"
should get correct content from XML
"
,
()
=>
{
expect
(
result
.
data
.
quantity
[
0
].
noQuantity
.
content
[
0
].
_text
).
toBe
(
select
(
xpath
.
noQuantity
.
content
,
dom
));
expect
(
result
.
data
.
quantity
[
0
].
noQuantity
.
content
[
0
].
_text
).
toBe
(
select
(
xpath
.
noQuantity
.
content
,
dom
));
});
});
test
(
"
should get correct fileName from XML
"
,
()
=>
{
test
(
"
should get correct fileName from XML
"
,
()
=>
{
expect
(
result
.
data
.
quantity
[
0
].
noQuantity
.
file
[
0
].
fileName
.
_text
).
toBe
(
select
(
xpath
.
noQuantity
.
file
.
fileName
,
dom
));
expect
(
result
.
data
.
quantity
[
0
].
noQuantity
.
file
[
0
].
fileName
.
_text
).
toBe
(
select
(
xpath
.
noQuantity
.
file
.
fileName
,
dom
));
});
});
test
(
"
should get correct mimeType from XML
"
,
()
=>
{
test
(
"
should get correct mimeType from XML
"
,
()
=>
{
expect
(
result
.
data
.
quantity
[
0
].
noQuantity
.
file
[
0
].
mimeType
.
_text
).
toBe
(
select
(
xpath
.
noQuantity
.
file
.
mimeType
,
dom
));
expect
(
result
.
data
.
quantity
[
0
].
noQuantity
.
file
[
0
].
mimeType
.
_text
).
toBe
(
select
(
xpath
.
noQuantity
.
file
.
mimeType
,
dom
));
});
});
test
(
"
should get correct latex formula from XML
"
,
()
=>
{
test
(
"
should get correct latex formula from XML
"
,
()
=>
{
expect
(
result
.
data
.
quantity
[
0
].
noQuantity
.
formula
[
0
].
latex
.
_text
).
toBe
(
select
(
xpath
.
noQuantity
.
formula
.
latex
,
dom
));
expect
(
result
.
data
.
quantity
[
0
].
noQuantity
.
formula
[
0
].
latex
.
_text
).
toBe
(
select
(
xpath
.
noQuantity
.
formula
.
latex
,
dom
));
});
});
...
...
This diff is collapsed.
Click to expand it.
tests/resources/example.xml
+
1
−
1
View file @
676a4794
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<dcc:digitalCalibrationCertificate
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:dcc=
"https://ptb.de/dcc"
xmlns:si=
"https://ptb.de/si"
xsi:schemaLocation=
"https://ptb.de/dcc https://ptb.de/dcc/v3.
1.2
/dcc.xsd"
schemaVersion=
"3.
1.2
"
>
<dcc:digitalCalibrationCertificate
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:dcc=
"https://ptb.de/dcc"
xmlns:si=
"https://ptb.de/si"
xsi:schemaLocation=
"https://ptb.de/dcc https://ptb.de/dcc/v3.
2.0
/dcc.xsd"
schemaVersion=
"3.
2.0
"
>
<dcc:administrativeData>
<dcc:administrativeData>
<dcc:dccSoftware>
<dcc:dccSoftware>
<dcc:software>
<dcc:software>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment