Skip to content

Commit

Permalink
All tests should now work as intended, even if the field to update in…
Browse files Browse the repository at this point in the history
… Idylis is originally empty before update
  • Loading branch information
Alexandre-Masson committed Sep 15, 2021
1 parent 6b50cf6 commit 38863d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/IdylisAPI/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('The IdyliAPI class', () => {
0,
'REFTVADISTINCT',
[{'COMPTEVENTETVA': `${compteAchatTest}`}],
'7',
'2',
);

expect(receivedValue)
Expand Down
5 changes: 3 additions & 2 deletions src/IdylisAPI/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ export default class IdylisAPI {
const originValue: string[] = Object.values(keyToCheck);
const updatedValue: string[] = Object.values(table);

if (typeguards.isCdata(keyToCheck) && keyToCheck?.__cdata !== '') {
if (typeguards.isCdata(keyToCheck)) {
if (String(originValue) !== String(updatedValue)) {
majTableJson[docType].FICHE[String(keyToUpdate)] = `<![CDATA[${Object.values({__cdata: String(updatedValue)})}]]]]><![CDATA[>`;
jsonDocumentFicheToUpdate[String(keyToUpdate)] = {__cdata: String(updatedValue)};
Expand Down Expand Up @@ -579,7 +579,7 @@ export default class IdylisAPI {
const originValue: string[] = Object.values(keyToCheck);
const updatedValue: string[] = Object.values(table);

if (typeguards.isCdata(keyToCheck) && keyToCheck?.__cdata !== '') {
if (typeguards.isCdata(keyToCheck)) {
if (String(originValue) === String(updatedValue)) {
updateConfirmation = true;
} else {
Expand Down Expand Up @@ -610,6 +610,7 @@ export default class IdylisAPI {
};
} else {
/* istanbul ignore next */
console.log('primarykey is not a string');
updateConfirmation = false;
};
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/typeguards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class Typeguards {
* is the one expected
*/
isPrimaryKeyValue(
primaryKeyValue: string | void,
primaryKeyValue: string | undefined,
): primaryKeyValue is string {
return !!primaryKeyValue;
};
Expand Down

0 comments on commit 38863d2

Please sign in to comment.