Skip to content

Commit cde7bde

Browse files
fixup
1 parent b2f109e commit cde7bde

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

tDataTypeTemplates/nsdToJson.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe("NSD to Json parsing function", () => {
3030
expect(data[key]).to.deep.equal(sClass[key]);
3131
});
3232
});
33-
});
33+
}).timeout(10000);
3434

3535
it("returns object that compares well to static 7-420 classes", async () => {
3636
const data = nsdToJson("DSTK");

tDataTypeTemplates/nsdToJson.ts

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ type SubDaDescription = {
2828
defaultValue?: string;
2929
isArray?: string;
3030
sizeAttribute?: string;
31-
typeKind?:string;
32-
minValue?:string;
33-
maxValue?:string;
31+
typeKind?: string;
32+
minValue?: string;
33+
maxValue?: string;
3434
children?: DaChildren;
3535
};
3636

@@ -73,11 +73,14 @@ type DaDescription = {
7373
isArray?: string;
7474
sizeAttribute?: string;
7575
defaultValue?: string;
76-
presCondArgs?:string
76+
presCondArgs?: string;
7777
children?: DaChildren;
7878
};
7979

80-
type CdcChildren = Record<string, DaDescription | ServiceDaDescription | CdcDescription>;
80+
type CdcChildren = Record<
81+
string,
82+
DaDescription | ServiceDaDescription | CdcDescription
83+
>;
8184
type CdcDescription = {
8285
tagName: string;
8386
name: string;
@@ -90,12 +93,12 @@ type CdcDescription = {
9093
dsPresCondArgs?: string;
9194
presCondArgs?: string;
9295
underlyingType?: string;
93-
underlyingTypeKind?:string;
94-
transient?:string;
95-
mandatory?:boolean;
96-
deprecated?:string;
96+
underlyingTypeKind?: string;
97+
transient?: string;
98+
mandatory?: boolean;
99+
deprecated?: string;
97100
isArray?: string;
98-
sizeAttribute?:string;
101+
sizeAttribute?: string;
99102
children: CdcChildren;
100103
};
101104

@@ -118,8 +121,8 @@ const defaultDoc7420 = new DOMParser().parseFromString(
118121
);
119122
const defaultDoc81 = new DOMParser().parseFromString(nsd81, "application/xml");
120123

121-
/** A utility function that returns a JSON containing the structure of a logical node class
122-
* as described in the IEC 61850-7-4 and IEC 61850-7-420 as JSON
124+
/** A utility function that returns a JSON containing the structure of a logical node class
125+
* as described in the IEC 61850-7-4 and IEC 61850-7-420 as JSON
123126
* @param lnClass the logical node class to be constructed
124127
* @param nsds user defined NSD files defaulting to
125128
* 8-1: 2003A2
@@ -269,7 +272,11 @@ export function nsdToJson(
269272
const descID = literal.getAttribute("descID")!;
270273
const deprecated = literal.getAttribute("deprecated")!;
271274

272-
const data: EnumValDescription = { tagName: literal.tagName, name, literalVal };
275+
const data: EnumValDescription = {
276+
tagName: literal.tagName,
277+
name,
278+
literalVal,
279+
};
273280
if (descID) data["descID"] = descID;
274281
if (deprecated) data["deprecated"] = deprecated;
275282

@@ -291,7 +298,13 @@ export function nsdToJson(
291298
"typeKind",
292299
].map((attr) => serviceConstructedAttribute.getAttribute(attr)!);
293300

294-
const data: ServiceConstructedAttribute = { tagName, name, presCond, descID, typeKind };
301+
const data: ServiceConstructedAttribute = {
302+
tagName,
303+
name,
304+
presCond,
305+
descID,
306+
typeKind,
307+
};
295308

296309
if (type) data["type"] = type;
297310

0 commit comments

Comments
 (0)