From ab43174873b096832c33c308033a9a6959d698f9 Mon Sep 17 00:00:00 2001 From: maxlath Date: Fri, 23 Sep 2022 08:26:04 +0200 Subject: [PATCH] Revert "simplifyClaims: remove empty claims arrays" This reverts commit e45a7e9108b0898a5b23b36ea5af3f52fc6c5dd0. Addressing the breaking change notified in https://twitter.com/tmtm/status/1573163687841513478 --- lib/helpers/simplify_claims.js | 5 +---- test/simplify_claims.js | 7 ------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/helpers/simplify_claims.js b/lib/helpers/simplify_claims.js index 493f4a46..f683ad49 100644 --- a/lib/helpers/simplify_claims.js +++ b/lib/helpers/simplify_claims.js @@ -12,10 +12,7 @@ const simplifyClaims = (claims, ...options) => { if (propertyPrefix) { id = propertyPrefix + ':' + id } - const simplifiedPropertyClaims = simplifyPropertyClaims(propClaims, ...options) - if (simplifiedPropertyClaims.length > 0) { - simpleClaims[id] = simplifiedPropertyClaims - } + simpleClaims[id] = simplifyPropertyClaims(propClaims, ...options) } return simpleClaims } diff --git a/test/simplify_claims.js b/test/simplify_claims.js index 826b3daf..dcadcd9a 100644 --- a/test/simplify_claims.js +++ b/test/simplify_claims.js @@ -164,13 +164,6 @@ describe('simplifyPropertyClaims', () => { simplified.should.deepEqual([ 'Q2044250' ]) }) - it('should not return empty claims arrays', () => { - const deprecatedClaim = Q4115189.claims.P135[0] - const claims = { P135: [ deprecatedClaim ] } - const simplified = simplifyClaims(claims) - should(simplified.P135).not.be.ok() - }) - it('should return non-truthy statements if requested', () => { const options = { keepNonTruthy: true } const simplified = simplifyPropertyClaims(Q4115189.claims.P135, options)