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
26
Merged
Jan Loewe
requested to merge
feat-jest-tests
into
master
2 years ago
Overview
1
Commits
50
Pipelines
42
Changes
2
Expand
0
0
Merge request reports
Compare
version 12
version 41
c8e67a97
2 years ago
version 40
9907f5ff
2 years ago
version 39
0dca95ae
2 years ago
version 38
d54ed508
2 years ago
version 37
2d040c7d
2 years ago
version 36
3ce16294
2 years ago
version 35
b749cf7a
2 years ago
version 34
ff9b82e7
2 years ago
version 33
5ff50525
2 years ago
version 32
fd38c2ad
2 years ago
version 31
e4bd5511
2 years ago
version 30
7ad5528f
2 years ago
version 29
55b067a5
2 years ago
version 28
a7c25458
2 years ago
version 27
5dc29904
2 years ago
version 26
8b0f2c47
2 years ago
version 25
a96f96b3
2 years ago
version 24
85335f4d
2 years ago
version 23
8a2e43ed
2 years ago
version 22
9ed99af5
2 years ago
version 21
cd7fe3b5
2 years ago
version 20
61f5d70b
2 years ago
version 19
9b85eaa6
2 years ago
version 18
b46df2cf
2 years ago
version 17
870d23e8
2 years ago
version 16
7dfdfd32
2 years ago
version 15
b576567e
2 years ago
version 14
0d28d88b
2 years ago
version 13
06949aab
2 years ago
version 12
8367b81d
2 years ago
version 11
51ee3365
2 years ago
version 10
7bf63308
2 years ago
version 9
8876d1c0
2 years ago
version 8
b8bbec9c
2 years ago
version 7
676a4794
2 years ago
version 6
590f6bc4
2 years ago
version 5
c85c32e0
2 years ago
version 4
90799b4f
2 years ago
version 3
b695cb4b
2 years ago
version 2
273bb61e
2 years ago
version 1
63bfb1f3
2 years ago
master (base)
and
version 13
latest version
2c33b2e7
50 commits,
1 year ago
version 41
c8e67a97
48 commits,
2 years ago
version 40
9907f5ff
47 commits,
2 years ago
version 39
0dca95ae
46 commits,
2 years ago
version 38
d54ed508
45 commits,
2 years ago
version 37
2d040c7d
44 commits,
2 years ago
version 36
3ce16294
43 commits,
2 years ago
version 35
b749cf7a
42 commits,
2 years ago
version 34
ff9b82e7
41 commits,
2 years ago
version 33
5ff50525
40 commits,
2 years ago
version 32
fd38c2ad
39 commits,
2 years ago
version 31
e4bd5511
38 commits,
2 years ago
version 30
7ad5528f
37 commits,
2 years ago
version 29
55b067a5
36 commits,
2 years ago
version 28
a7c25458
35 commits,
2 years ago
version 27
5dc29904
34 commits,
2 years ago
version 26
8b0f2c47
33 commits,
2 years ago
version 25
a96f96b3
32 commits,
2 years ago
version 24
85335f4d
31 commits,
2 years ago
version 23
8a2e43ed
30 commits,
2 years ago
version 22
9ed99af5
29 commits,
2 years ago
version 21
cd7fe3b5
28 commits,
2 years ago
version 20
61f5d70b
27 commits,
2 years ago
version 19
9b85eaa6
26 commits,
2 years ago
version 18
b46df2cf
25 commits,
2 years ago
version 17
870d23e8
24 commits,
2 years ago
version 16
7dfdfd32
23 commits,
2 years ago
version 15
b576567e
22 commits,
2 years ago
version 14
0d28d88b
21 commits,
2 years ago
version 13
06949aab
19 commits,
2 years ago
version 12
8367b81d
18 commits,
2 years ago
version 11
51ee3365
17 commits,
2 years ago
version 10
7bf63308
16 commits,
2 years ago
version 9
8876d1c0
15 commits,
2 years ago
version 8
b8bbec9c
14 commits,
2 years ago
version 7
676a4794
12 commits,
2 years ago
version 6
590f6bc4
11 commits,
2 years ago
version 5
c85c32e0
10 commits,
2 years ago
version 4
90799b4f
9 commits,
2 years ago
version 3
b695cb4b
8 commits,
2 years ago
version 2
273bb61e
7 commits,
2 years ago
version 1
63bfb1f3
6 commits,
2 years ago
Show latest version
2 files
+
47
−
38
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
tests/DCC/AdministrativeData.Customer.test.ts
+
27
−
22
Options
@@ -8,22 +8,27 @@ import { ContactType, DCCDocument, LocationType } from "../../src";
const
base
=
"
//dcc:administrativeData/dcc:customer
"
;
const
xpath
=
{
customerNameContent
:
`
${
base
}
/dcc:name/dcc:content`
,
customerEmail
:
`string(
${
base
}
/dcc:eMail)`
,
customerPhone
:
`
${
base
}
/dcc:phone)`
,
customerFax
:
`
${
base
}
/dcc:fax)`
,
customerLocation
:
`
${
base
}
/dcc:location`
,
customerLocationCity
:
`
${
base
}
/dcc:location/dcc:city[1]`
,
customerLocationCountryCode
:
`
${
base
}
/dcc:location/dcc:countryCode[1]`
,
customerLocationPostCode
:
`
${
base
}
/dcc:location/dcc:postCode[1]`
,
customerLocationPostBoxOffice
:
`
${
base
}
/dcc:location/dcc:postBoxOffice[1]`
,
customerLocationState
:
`
${
base
}
/dcc:location/dcc:state[1]`
,
customerLocationStreet
:
`
${
base
}
/dcc:location/dcc:street[1]`
,
customerLocationStreetNo
:
`
${
base
}
/dcc:location/dcc:streetNo[1]`
,
customerLocationFurther
:
`
${
base
}
/dcc:location/dcc:further[1]/dcc:content`
,
customerLocationPositionCoordinates
:
`
${
base
}
/dcc:location/dcc:positionCoordinates[1]`
,
customerDescriptionData
:
`
${
base
}
/dcc:descriptionData`
,
customerId
:
`
${
base
}
/@id`
,
customer
:
{
name
:
{
content
:
`
${
base
}
/dcc:name/dcc:content`
,
},
email
:
`string(
${
base
}
/dcc:eMail)`
,
phone
:
`
${
base
}
/dcc:phone)`
,
fax
:
`
${
base
}
/dcc:fax)`
,
location
:
{
city
:
`
${
base
}
/dcc:location/dcc:city[1]`
,
countryCode
:
`
${
base
}
/dcc:location/dcc:countryCode[1]`
,
postCode
:
`
${
base
}
/dcc:location/dcc:postCode[1]`
,
postBoxOffice
:
`
${
base
}
/dcc:location/dcc:postBoxOffice[1]`
,
state
:
`
${
base
}
/dcc:location/dcc:state[1]`
,
street
:
`
${
base
}
/dcc:location/dcc:street[1]`
,
streetNo
:
`
${
base
}
/dcc:location/dcc:streetNo[1]`
,
further
:
`
${
base
}
/dcc:location/dcc:further[1]/dcc:content`
,
positionCoordinates
:
`
${
base
}
/dcc:location/dcc:positionCoordinates[1]`
,
},
descriptionData
:
`
${
base
}
/dcc:descriptionData`
,
_id
:
`
${
base
}
/@id`
,
},
};
describe
(
"
ContactType
"
,
()
=>
{
@@ -37,31 +42,31 @@ describe("ContactType", () => {
test
(
"
should get correct customer name content from XML
"
,
()
=>
{
// get expected list from example xml
const
expected
=
<
Element
[]
>
select
(
xpath
.
customer
N
ame
C
ontent
,
dom
);
const
expected
=
<
Element
[]
>
select
(
xpath
.
customer
.
n
ame
.
c
ontent
,
dom
);
expect
(
toTextArr
(
customer
.
name
.
content
)).
toEqual
(
toTextContentArr
(
expected
));
});
test
(
"
should get correct customer email address from XML
"
,
()
=>
{
expect
(
customer
.
eMail
.
_text
).
toBe
(
select
(
xpath
.
customer
E
mail
,
dom
));
expect
(
customer
.
eMail
.
_text
).
toBe
(
select
(
xpath
.
customer
.
e
mail
,
dom
));
});
test
(
"
should get correct customer location city from XML
"
,
()
=>
{
const
expected
=
<
Element
[]
>
select
(
xpath
.
customer
L
ocation
C
ity
,
dom
);
const
expected
=
<
Element
[]
>
select
(
xpath
.
customer
.
l
ocation
.
c
ity
,
dom
);
expect
(
customer
.
location
.
city
[
0
].
_text
).
toEqual
(
toTextContentArr
(
expected
).
pop
());
});
test
(
"
should get correct customer location county code from XML
"
,
()
=>
{
const
expected
=
<
Element
[]
>
select
(
xpath
.
customer
L
ocation
C
ountryCode
,
dom
);
const
expected
=
<
Element
[]
>
select
(
xpath
.
customer
.
l
ocation
.
c
ountryCode
,
dom
);
expect
(
customer
.
location
.
countryCode
[
0
].
_text
).
toEqual
(
toTextContentArr
(
expected
).
pop
());
});
test
(
"
should get correct customer location post code from XML
"
,
()
=>
{
const
expected
=
<
Element
[]
>
select
(
xpath
.
customer
L
ocation
P
ostCode
,
dom
);
const
expected
=
<
Element
[]
>
select
(
xpath
.
customer
.
l
ocation
.
p
ostCode
,
dom
);
expect
(
customer
.
location
.
postCode
[
0
].
_text
).
toEqual
(
toTextContentArr
(
expected
).
pop
());
});
test
(
"
should get correct customer location further from XML
"
,
()
=>
{
const
expected
=
<
Element
[]
>
select
(
xpath
.
customer
L
ocation
F
urther
,
dom
);
const
expected
=
<
Element
[]
>
select
(
xpath
.
customer
.
l
ocation
.
f
urther
,
dom
);
for
(
var
i
=
0
;
i
<
expected
.
length
;
i
++
)
{
expect
(
customer
.
location
.
further
[
0
].
content
[
i
].
_text
).
toBe
(
expected
[
i
].
textContent
);
Loading