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
06949aab
Commit
06949aab
authored
2 years ago
by
Muhammed-Ali Demir
Browse files
Options
Downloads
Patches
Plain Diff
test: updated tests for ad customer and ad software list
parent
8367b81d
No related branches found
No related tags found
3 merge requests
!10
Refactor Test Resources
,
!6
Adaptations for new DCC V3.2.1
,
!5
Add tests
Pipeline
#19244
passed
2 years ago
Stage: .pre
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/DCC/AdministrativeData.Customer.test.ts
+27
-22
27 additions, 22 deletions
tests/DCC/AdministrativeData.Customer.test.ts
tests/DCC/AdministrativeData.SoftwareListType.test.ts
+20
-16
20 additions, 16 deletions
tests/DCC/AdministrativeData.SoftwareListType.test.ts
with
47 additions
and
38 deletions
tests/DCC/AdministrativeData.Customer.test.ts
+
27
−
22
View file @
06949aab
...
@@ -8,22 +8,27 @@ import { ContactType, DCCDocument, LocationType } from "../../src";
...
@@ -8,22 +8,27 @@ import { ContactType, DCCDocument, LocationType } from "../../src";
const
base
=
"
//dcc:administrativeData/dcc:customer
"
;
const
base
=
"
//dcc:administrativeData/dcc:customer
"
;
const
xpath
=
{
const
xpath
=
{
customerNameContent
:
`
${
base
}
/dcc:name/dcc:content`
,
customer
:
{
customerEmail
:
`string(
${
base
}
/dcc:eMail)`
,
name
:
{
customerPhone
:
`
${
base
}
/dcc:phone)`
,
content
:
`
${
base
}
/dcc:name/dcc:content`
,
customerFax
:
`
${
base
}
/dcc:fax)`
,
},
customerLocation
:
`
${
base
}
/dcc:location`
,
email
:
`string(
${
base
}
/dcc:eMail)`
,
customerLocationCity
:
`
${
base
}
/dcc:location/dcc:city[1]`
,
phone
:
`
${
base
}
/dcc:phone)`
,
customerLocationCountryCode
:
`
${
base
}
/dcc:location/dcc:countryCode[1]`
,
fax
:
`
${
base
}
/dcc:fax)`
,
customerLocationPostCode
:
`
${
base
}
/dcc:location/dcc:postCode[1]`
,
location
:
{
customerLocationPostBoxOffice
:
`
${
base
}
/dcc:location/dcc:postBoxOffice[1]`
,
city
:
`
${
base
}
/dcc:location/dcc:city[1]`
,
customerLocationState
:
`
${
base
}
/dcc:location/dcc:state[1]`
,
countryCode
:
`
${
base
}
/dcc:location/dcc:countryCode[1]`
,
customerLocationStreet
:
`
${
base
}
/dcc:location/dcc:street[1]`
,
postCode
:
`
${
base
}
/dcc:location/dcc:postCode[1]`
,
customerLocationStreetNo
:
`
${
base
}
/dcc:location/dcc:streetNo[1]`
,
postBoxOffice
:
`
${
base
}
/dcc:location/dcc:postBoxOffice[1]`
,
customerLocationFurther
:
`
${
base
}
/dcc:location/dcc:further[1]/dcc:content`
,
state
:
`
${
base
}
/dcc:location/dcc:state[1]`
,
customerLocationPositionCoordinates
:
`
${
base
}
/dcc:location/dcc:positionCoordinates[1]`
,
street
:
`
${
base
}
/dcc:location/dcc:street[1]`
,
customerDescriptionData
:
`
${
base
}
/dcc:descriptionData`
,
streetNo
:
`
${
base
}
/dcc:location/dcc:streetNo[1]`
,
customerId
:
`
${
base
}
/@id`
,
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
"
,
()
=>
{
describe
(
"
ContactType
"
,
()
=>
{
...
@@ -37,31 +42,31 @@ describe("ContactType", () => {
...
@@ -37,31 +42,31 @@ describe("ContactType", () => {
test
(
"
should get correct customer name content from XML
"
,
()
=>
{
test
(
"
should get correct customer name content from XML
"
,
()
=>
{
// get expected list from example 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
));
expect
(
toTextArr
(
customer
.
name
.
content
)).
toEqual
(
toTextContentArr
(
expected
));
});
});
test
(
"
should get correct customer email address from XML
"
,
()
=>
{
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
"
,
()
=>
{
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
());
expect
(
customer
.
location
.
city
[
0
].
_text
).
toEqual
(
toTextContentArr
(
expected
).
pop
());
});
});
test
(
"
should get correct customer location county code from XML
"
,
()
=>
{
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
());
expect
(
customer
.
location
.
countryCode
[
0
].
_text
).
toEqual
(
toTextContentArr
(
expected
).
pop
());
});
});
test
(
"
should get correct customer location post code from XML
"
,
()
=>
{
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
());
expect
(
customer
.
location
.
postCode
[
0
].
_text
).
toEqual
(
toTextContentArr
(
expected
).
pop
());
});
});
test
(
"
should get correct customer location further from XML
"
,
()
=>
{
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
++
)
{
for
(
var
i
=
0
;
i
<
expected
.
length
;
i
++
)
{
expect
(
customer
.
location
.
further
[
0
].
content
[
i
].
_text
).
toBe
(
expected
[
i
].
textContent
);
expect
(
customer
.
location
.
further
[
0
].
content
[
i
].
_text
).
toBe
(
expected
[
i
].
textContent
);
...
...
This diff is collapsed.
Click to expand it.
tests/DCC/AdministrativeData.SoftwareListType.test.ts
+
20
−
16
View file @
06949aab
...
@@ -8,12 +8,16 @@ import { SoftwareListType, DCCDocument, SoftwareType } from "../../src";
...
@@ -8,12 +8,16 @@ import { SoftwareListType, DCCDocument, SoftwareType } from "../../src";
const
base
=
"
//dcc:administrativeData/dcc:dccSoftware/dcc:software
"
;
const
base
=
"
//dcc:administrativeData/dcc:dccSoftware/dcc:software
"
;
const
xpath
=
{
const
xpath
=
{
softwareNameContent
:
`
${
base
}
/dcc:name/dcc:content`
,
software
:
{
softwareRelease
:
`string(
${
base
}
/dcc:release)`
,
name
:
{
softwareType
:
`string(
${
base
}
/dcc:type)`
,
content
:
`
${
base
}
/dcc:name/dcc:content`
,
softwareDescription
:
`
${
base
}
/dcc:description`
,
},
softwareTypeId
:
`
${
base
}
/@id`
,
release
:
`string(
${
base
}
/dcc:release)`
,
softwareTypeRefType
:
`
${
base
}
/@refType`
,
type
:
`string(
${
base
}
/dcc:type)`
,
description
:
`
${
base
}
/dcc:description`
,
_id
:
`
${
base
}
/@id`
,
_refType
:
`
${
base
}
/@refType`
,
},
};
};
describe
(
"
DccSoftwareType
"
,
()
=>
{
describe
(
"
DccSoftwareType
"
,
()
=>
{
...
@@ -27,19 +31,19 @@ describe("DccSoftwareType", () => {
...
@@ -27,19 +31,19 @@ describe("DccSoftwareType", () => {
test
(
"
should get correct software name content from XML
"
,
()
=>
{
test
(
"
should get correct software name content from XML
"
,
()
=>
{
// get expected list from example xml
// get expected list from example xml
const
expected
=
<
Element
[]
>
select
(
xpath
.
software
N
ame
C
ontent
,
dom
);
const
expected
=
<
Element
[]
>
select
(
xpath
.
software
.
n
ame
.
c
ontent
,
dom
);
expect
(
toTextArr
(
software
.
name
.
content
)).
toEqual
(
toTextContentArr
(
expected
));
expect
(
toTextArr
(
software
.
name
.
content
)).
toEqual
(
toTextContentArr
(
expected
));
});
});
test
(
"
should get correct software release version of software from XML
"
,
()
=>
{
test
(
"
should get correct software release version of software from XML
"
,
()
=>
{
expect
(
software
.
release
.
_text
).
toBe
(
select
(
xpath
.
software
R
elease
,
dom
));
expect
(
software
.
release
.
_text
).
toBe
(
select
(
xpath
.
software
.
r
elease
,
dom
));
});
});
/*
/*
test("should get correct software type of software from XML", () => {
test("should get correct software type of software from XML", () => {
console.log(software);
console.log(software);
if (select(xpath.software
T
ype, dom)) {
if (select(xpath.software
.t
ype, dom)) {
expect(software.type._text).toBe(select(xpath.software
T
ype, dom));
expect(software.type._text).toBe(select(xpath.software
.t
ype, dom));
}
}
});
});
*/
*/
...
@@ -48,16 +52,16 @@ describe("DccSoftwareType", () => {
...
@@ -48,16 +52,16 @@ describe("DccSoftwareType", () => {
/*
/*
test("should get correct software reftype ...", () => {
test("should get correct software reftype ...", () => {
console.log(select(xpath.software
TypeR
efType, dom));
console.log(select(xpath.software
._r
efType, dom));
if (select(xpath.software
TypeR
efType, dom) != "") {
if (select(xpath.software
._r
efType, dom) != "") {
expect(software._attr.refType).toBe(select(xpath.software
TypeR
efType, dom));
expect(software._attr.refType).toBe(select(xpath.software
._r
efType, dom));
}
}
});
});
test("should get correct software id ...", () => {
test("should get correct software id ...", () => {
console.log(select(xpath.software
TypeI
d, dom));
console.log(select(xpath.software
._i
d, dom));
if (select(xpath.software
TypeI
d, dom) != "") {
if (select(xpath.software
._i
d, dom) != "") {
expect(software._attr.id).toBe(select(xpath.software
TypeI
d, dom));
expect(software._attr.id).toBe(select(xpath.software
._i
d, dom));
}
}
});*/
});*/
});
});
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