Skip to content

Commit

Permalink
fix: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Mar 1, 2024
1 parent 8610eb9 commit 5542e8a
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 232 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ extends: cheminfo-typescript
parserOptions:
sourceType: module
env:
node: true
node: true
jest: true
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@
},
"homepage": "https://github.com/cheminfo/arraybuffer-xml-parser#readme",
"devDependencies": {
"@types/he": "^1.1.2",
"@types/jest": "^29.2.0",
"cheminfo-build": "^1.1.11",
"eslint": "^8.25.0",
"eslint-config-cheminfo-typescript": "^11.1.0",
"@types/he": "^1.2.3",
"@types/jest": "^29.5.12",
"cheminfo-build": "^1.2.0",
"eslint": "^8.57.0",
"eslint-config-cheminfo-typescript": "^12.2.0",
"he": "^1.2.0",
"iobuffer": "^5.2.1",
"jest": "^29.2.1",
"pako": "^2.0.4",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"typescript": "^4.8.4",
"iobuffer": "^5.3.2",
"jest": "^29.7.0",
"pako": "^2.1.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.2",
"typescript": "^5.3.3",
"uint8-base64": "^0.1.1"
},
"dependencies": {
Expand Down
182 changes: 6 additions & 176 deletions src/__tests__/attributesSpec.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jest/no-commented-out-tests */
// import he from 'he';

import { parse } from '../parse';
Expand All @@ -18,7 +17,7 @@ describe('XMLParser', () => {
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
attributeNamePrefix: '',
ignoreAttributes: false,
dynamicTypingAttributeValue: true,
Expand All @@ -42,7 +41,7 @@ describe('XMLParser', () => {
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
attributeNamePrefix: '',
ignoreAttributes: false,
dynamicTypingAttributeValue: true,
Expand All @@ -66,7 +65,7 @@ describe('XMLParser', () => {
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
attributeNamePrefix: '',
ignoreAttributes: false,
dynamicTypingAttributeValue: true,
Expand All @@ -91,7 +90,7 @@ describe('XMLParser', () => {
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
attributeNamePrefix: '',
ignoreAttributes: false,
dynamicTypingAttributeValue: true,
Expand All @@ -118,7 +117,7 @@ describe('XMLParser', () => {
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
attributeNamePrefix: '',
ignoreAttributes: false,
});
Expand All @@ -143,181 +142,12 @@ describe('XMLParser', () => {
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
attributeNamePrefix: '',
ignoreAttributes: false,
ignoreNameSpace: true,
});

expect(result).toStrictEqual(expected);

// result = validator.validate(xmlData, {
// allowBooleanAttributes: true,
// });
// // expect(result).toBe(true);
});

// it('should not parse attributes with name start with number', () => {
// const xmlData = encoder.encode(
// `<issue 35entity="Mjg2MzY2OTkyNA==" ></issue>`,
// );

// const expected = {
// err: {
// code: 'InvalidAttr',
// msg: "Attribute '35entity' is an invalid name.",
// line: 1,
// },
// };
// const result = validator.validate(xmlData);

// expect(result).toStrictEqual(expected);
// });

// it('should not parse attributes with invalid char', () => {
// const xmlData = encoder.encode(
// `<issue enti+ty="Mjg2MzY2OTkyNA=="></issue>`,
// );
// const expected = {
// err: {
// code: 'InvalidAttr',
// msg: "Attribute 'enti+ty' is an invalid name.",
// line: 1,
// },
// };

// const result = validator.validate(xmlData);

// expect(result).toStrictEqual(expected);
// });

// it('should not parse attributes in closing tag', () => {
// const xmlData = encoder.encode(`<issue></issue invalid="true">`);
// const expected = {
// err: {
// code: 'InvalidTag',
// msg: "Closing tag 'issue' can't have attributes or invalid starting.",
// line: 1,
// },
// };
// const result = validator.validate(xmlData);

// expect(result).toStrictEqual(expected);
// });

// it('should err for invalid atributes', () => {
// const xmlData = encoder.encode(`<rootNode =''></rootNode>`);
// const expected = {
// err: {
// code: 'InvalidAttr',
// msg: "Attribute '''' has no space in starting.",
// line: 1,
// },
// };
// const result = validator.validate(xmlData);
// expect(result).toStrictEqual(expected);
// });

// it('should validate xml with atributes', () => {
// const xmlData = encoder.encode(
// `<rootNode attr="123"><tag></tag><tag>1</tag><tag>val</tag></rootNode>`,
// );

// const result = validator.validate(xmlData);
// expect(result).toBe(true);
// });

// it("should validate xml atribute has '>' in value", () => {
// const xmlData = encoder.encode(
// `<rootNode attr="123>234"><tag></tag><tag>1</tag><tag>val</tag></rootNode>`,
// );

// const result = validator.validate(xmlData);
// expect(result).toBe(true);
// });

// it('should not validate xml with invalid atributes', () => {
// const xmlData = encoder.encode(
// `<rootNode attr="123><tag></tag><tag>1</tag><tag>val</tag></rootNode>`,
// );
// const expected = {
// err: {
// code: 'InvalidAttr',
// msg: "Attributes for 'rootNode' have open quote.",
// line: 1,
// },
// };
// const result = validator.validate(xmlData);
// expect(result).toStrictEqual(expected);
// });

// it('should not validate xml with invalid attributes when duplicate attributes present', () => {
// const xmlData = encoder.encode(`<rootNode abc='123' abc="567" />`);
// const expected = {
// err: {
// code: 'InvalidAttr',
// msg: "Attribute 'abc' is repeated.",
// line: 1,
// },
// };
// const result = validator.validate(xmlData);
// //console.log(JSON.stringify(result,null,4));
// expect(result).toStrictEqual(expected);
// });

// it('should not validate xml with invalid attributes when no space between 2 attributes', () => {
// const xmlData = encoder.encode(`<rootNode abc='123'bc='567' />`);
// const expected = {
// err: {
// code: 'InvalidAttr',
// msg: "Attribute 'bc' has no space in starting.",
// line: 1,
// },
// };
// const result = validator.validate(xmlData);
// expect(result).toStrictEqual(expected);
// });

// it('should not validate a tag with attribute presents without value', () => {
// const xmlData = encoder.encode(`<rootNode ab cd='ef'></rootNode>`);
// const expected = {
// err: {
// code: 'InvalidAttr',
// msg: "boolean attribute 'ab' is not allowed.",
// line: 1,
// },
// };
// const result = validator.validate(xmlData);
// expect(result).toStrictEqual(expected);
// });

// it('should not validate xml with invalid attributes presents without value', () => {
// const xmlData = encoder.encode(`<rootNode 123 abc='123' bc='567' />`);
// const expected = {
// err: {
// code: 'InvalidAttr',
// // "msg": "attribute 123 is an invalid name."
// msg: "boolean attribute '123' is not allowed.",
// line: 1,
// },
// };
// const result = validator.validate(xmlData);
// //console.log(JSON.stringify(result,null,4));
// expect(result).toStrictEqual(expected);
// });

// it('should validate xml with attributeshaving openquote in value', () => {
// const xmlData = encoder.encode('<rootNode 123 abc=\'1"23\' bc="56\'7" />');
// const expected = {
// err: {
// code: 'InvalidAttr',
// // "msg": "attribute 123 is an invalid name."
// msg: "boolean attribute '123' is not allowed.",
// line: 1,
// },
// };
// const result = validator.validate(xmlData);
// //console.log(JSON.stringify(result,null,4));
// expect(result).toStrictEqual(expected);
//});
});
12 changes: 6 additions & 6 deletions src/__tests__/cdataSpec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('XMLParser', () => {
const xmlData = encoder.encode(`<?xml version='1.0'?><root><person>lastname
firstname
patronymic</person></root>`);
let result = parse(xmlData, {
const result = parse(xmlData, {
ignoreAttributes: false,
});

Expand Down Expand Up @@ -45,7 +45,7 @@ patronymic</person></root>`);
},
},
};
let result = parse(xmlData, {
const result = parse(xmlData, {
ignoreAttributes: false,
});

Expand Down Expand Up @@ -78,7 +78,7 @@ patronymic</person></root>`);
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
ignoreAttributes: false,
});

Expand All @@ -105,7 +105,7 @@ patronymic</person></root>`);
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
ignoreAttributes: false,
});

Expand All @@ -126,7 +126,7 @@ patronymic</person></root>`);
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
ignoreAttributes: false,
});

Expand All @@ -147,7 +147,7 @@ patronymic</person></root>`);
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
ignoreAttributes: false,
});

Expand Down
4 changes: 1 addition & 3 deletions src/__tests__/cheminfo.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-tabs */

import { parse } from '../parse';

describe('XMLParser', () => {
Expand All @@ -11,7 +9,7 @@ describe('XMLParser', () => {

const expected = { AAA: { '#text': 12345678, AB: '' } };

let result = parse(xmlData, {});
const result = parse(xmlData, {});

expect(result).toStrictEqual(expected);
});
Expand Down
11 changes: 5 additions & 6 deletions src/__tests__/data.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable jest/no-identical-title */
import { parse } from '../parse';

const encoder = new TextEncoder();
Expand All @@ -21,7 +20,7 @@ describe('XMLParser', () => {
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
attributeNamePrefix: '',

//dynamicTypingAttributeValue: true
Expand Down Expand Up @@ -60,7 +59,7 @@ describe('XMLParser', () => {
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
//attributeNamePrefix: "",

//dynamicTypingAttributeValue: true,
Expand All @@ -70,7 +69,7 @@ describe('XMLParser', () => {
expect(result).toStrictEqual(expected);
});

it('should parse attributes with correct names', () => {
it('should parse attributes with correct names 2', () => {
const xmlData =
encoder.encode(`<a:root xmlns:a="urn:none" xmlns:a-b="urn:none">
<a:a attr="2foo&ampbar&apos;">1</a:a>
Expand Down Expand Up @@ -103,7 +102,7 @@ describe('XMLParser', () => {
},
},
};
let result = parse(xmlData, {
const result = parse(xmlData, {
//attributeNamePrefix: "",

//dynamicTypingAttributeValue: true,
Expand All @@ -125,7 +124,7 @@ describe('XMLParser', () => {
},
};

let result = parse(xmlData, {
const result = parse(xmlData, {
allowBooleanAttributes: true,
});

Expand Down
Loading

0 comments on commit 5542e8a

Please sign in to comment.