From e432108836de0bb7d8fda6c6f3caa6a45886af69 Mon Sep 17 00:00:00 2001 From: Vyacheslav Chub Date: Fri, 2 Feb 2018 15:55:13 +0200 Subject: [PATCH] fixed(rule): wrong DUPLICATED_DATA_POINT_TRANSLATION_KEY rule behavior Closes #481 --- package.json | 2 +- src/data/ddf-root.ts | 7 +- src/data/file-descriptor.ts | 2 + .../duplicated-data-point-translation-key.ts | 2 +- .../fixtures/companies-nl-ru/datapackage.json | 723 ++++++++++++++++++ .../companies-nl-ru/ddf--concepts.csv | 18 + ...ints--company_scale--by--company--anno.csv | 8 + ...ints--lines_of_code--by--company--anno.csv | 6 + ...es_of_code--by--company--project--anno.csv | 9 + ...s--lines_of_code--by--company--project.csv | 8 + ...lines_of_code--by--company_scale--anno.csv | 4 + ...ints--meeting_style--by--company--anno.csv | 4 + ...ting_style--by--company--project--anno.csv | 6 + ...eal--methodology--by--company--project.csv | 6 + .../ddf--entities--company--company_scale.csv | 4 + ...f--entities--company--english_speaking.csv | 3 + .../ddf--entities--company.csv | 5 + .../ddf--entities--project.csv | 6 + .../companies-nl-ru/ddf--entities--region.csv | 4 + .../lang/nl-nl/ddf--concepts.csv | 15 + ...ints--company_scale--by--company--anno.csv | 8 + ...eal--methodology--by--company--project.csv | 6 + .../ddf--entities--company--company_scale.csv | 4 + .../lang/nl-nl/ddf--entities--company.csv | 5 + .../lang/nl-nl/ddf--entities--region.csv | 4 + .../lang/ru-ru/ddf--concepts.csv | 12 + ...ints--company_scale--by--company--anno.csv | 8 + ...eal--methodology--by--company--project.csv | 6 + .../ddf--entities--company--company_scale.csv | 4 + .../lang/ru-ru/ddf--entities--company.csv | 5 + .../lang/ru-ru/ddf--entities--region.csv | 4 + test/translation-rules.spec.ts | 27 + 32 files changed, 930 insertions(+), 5 deletions(-) create mode 100644 test/fixtures/companies-nl-ru/datapackage.json create mode 100644 test/fixtures/companies-nl-ru/ddf--concepts.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--datapoints--company_scale--by--company--anno.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--anno.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--project--anno.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--project.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company_scale--anno.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--by--company--anno.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--by--company--project--anno.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--entities--company--company_scale.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--entities--company--english_speaking.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--entities--company.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--entities--project.csv create mode 100644 test/fixtures/companies-nl-ru/ddf--entities--region.csv create mode 100644 test/fixtures/companies-nl-ru/lang/nl-nl/ddf--concepts.csv create mode 100644 test/fixtures/companies-nl-ru/lang/nl-nl/ddf--datapoints--company_scale--by--company--anno.csv create mode 100644 test/fixtures/companies-nl-ru/lang/nl-nl/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv create mode 100644 test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--company--company_scale.csv create mode 100644 test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--company.csv create mode 100644 test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--region.csv create mode 100644 test/fixtures/companies-nl-ru/lang/ru-ru/ddf--concepts.csv create mode 100644 test/fixtures/companies-nl-ru/lang/ru-ru/ddf--datapoints--company_scale--by--company--anno.csv create mode 100644 test/fixtures/companies-nl-ru/lang/ru-ru/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv create mode 100644 test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--company--company_scale.csv create mode 100644 test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--company.csv create mode 100644 test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--region.csv diff --git a/package.json b/package.json index 5d03ae2..d8ef754 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "test-travis": "istanbul cover mocha _mocha -- -R spec --timeout 200000 --compilers ts:ts-node/register --recursive test/**/*.spec.ts && codecov", "changelog": "conventional-changelog -i CHANGELOG.md -s -p angular", "github-release": "conventional-github-releaser -p angular", - "build": "tsc && touch lib/package.json && echo \\{\\\"version\\\": \\\"1.11.0\\\"\\} > lib/package.json", + "build": "tsc && touch lib/package.json && echo \\{\\\"version\\\": \\\"1.12.0\\\"\\} > lib/package.json", "prepublish": "npm run build", "preversion": "npm test", "version": "npm run changelog && git add CHANGELOG.md", diff --git a/src/data/ddf-root.ts b/src/data/ddf-root.ts index 5e257b3..8df0107 100644 --- a/src/data/ddf-root.ts +++ b/src/data/ddf-root.ts @@ -43,13 +43,14 @@ export class DDFRoot { const translationFolder = resolve(this.path, TRNSLATIONS_FOLDER); fileDescriptor.transFileDescriptors = translationsIds - .map(translationsId => + .map(translationId => new FileDescriptor({ - dir: resolve(translationFolder, translationsId), + dir: resolve(translationFolder, translationId), file: fileDescriptor.file, type: fileDescriptor.type, primaryKey: fileDescriptor.primaryKey, - fullPath: resolve(translationFolder, translationsId, fileDescriptor.file), + fullPath: resolve(translationFolder, translationId, fileDescriptor.file), + translationId, isTranslation: true })); }); diff --git a/src/data/file-descriptor.ts b/src/data/file-descriptor.ts index d27d72b..b2ae012 100644 --- a/src/data/file-descriptor.ts +++ b/src/data/file-descriptor.ts @@ -50,6 +50,7 @@ export class FileDescriptor { public csvChecker: CsvChecker; public hasFirstLine: boolean; public isTranslation: boolean; + public translationId: boolean; public size: number; constructor(data) { @@ -62,6 +63,7 @@ export class FileDescriptor { this.fullPath = data.fullPath; this.csvChecker = new CsvChecker(this.fullPath); this.hasFirstLine = false; + this.translationId = data.translationId; this.isTranslation = data.isTranslation; } diff --git a/src/ddf-rules/translation-rules/duplicated-data-point-translation-key.ts b/src/ddf-rules/translation-rules/duplicated-data-point-translation-key.ts index 3683dde..684ddb4 100644 --- a/src/ddf-rules/translation-rules/duplicated-data-point-translation-key.ts +++ b/src/ddf-rules/translation-rules/duplicated-data-point-translation-key.ts @@ -14,7 +14,7 @@ export const rule = { const sortedPrimaryKey = dataPointDescriptor.fileDescriptor.primaryKey.sort(); const dimensionData = sortedPrimaryKey.map(keyPart => `${keyPart}:${dataPointDescriptor.record[keyPart]}`).join(','); const indicatorName = difference(dataPointDescriptor.fileDescriptor.headers, dataPointDescriptor.fileDescriptor.primaryKey).join(','); - const recordHash = `${dimensionData}@${indicatorName}`; + const recordHash = `${dimensionData}@${indicatorName}#${dataPointDescriptor.fileDescriptor.translationId}`; if (storage.hash.has(recordHash)) { storage.duplicatedHashes.push(recordHash); diff --git a/test/fixtures/companies-nl-ru/datapackage.json b/test/fixtures/companies-nl-ru/datapackage.json new file mode 100644 index 0000000..0893db1 --- /dev/null +++ b/test/fixtures/companies-nl-ru/datapackage.json @@ -0,0 +1,723 @@ +{ + "name": "ddf--ws-testing", + "title": "ddf--ws-testing", + "description": "", + "version": "0.0.1", + "language": { + "id": "en", + "name": "English" + }, + "translations": [ + { + "id": "nl-nl", + "name": "nl-nl" + }, + { + "id": "ru-ru", + "name": "ru-ru" + } + ], + "license": "", + "author": "", + "resources": [ + { + "path": "ddf--concepts.csv", + "name": "ddf--concepts", + "schema": { + "fields": [ + { + "name": "concept" + }, + { + "name": "concept_type" + }, + { + "name": "domain" + }, + { + "name": "additional_column" + } + ], + "primaryKey": "concept" + } + }, + { + "path": "ddf--datapoints--company_scale--by--company--anno.csv", + "name": "company_scale--by--company--anno", + "schema": { + "fields": [ + { + "name": "company" + }, + { + "name": "anno" + }, + { + "name": "company_scale" + } + ], + "primaryKey": [ + "company", + "anno" + ] + } + }, + { + "path": "ddf--datapoints--lines_of_code--by--company_scale--anno.csv", + "name": "lines_of_code--by--company_scale--anno", + "schema": { + "fields": [ + { + "name": "company" + }, + { + "name": "anno" + }, + { + "name": "lines_of_code" + } + ], + "primaryKey": [ + "company", + "anno" + ] + } + }, + { + "path": "ddf--datapoints--meeting_style--by--company--anno.csv", + "name": "meeting_style--by--company--anno", + "schema": { + "fields": [ + { + "name": "company" + }, + { + "name": "anno" + }, + { + "name": "meeting_style" + } + ], + "primaryKey": [ + "company", + "anno" + ] + } + }, + { + "path": "ddf--datapoints--meeting_style--by--company--project--anno.csv", + "name": "meeting_style--by--company--project--anno", + "schema": { + "fields": [ + { + "name": "company" + }, + { + "name": "project" + }, + { + "name": "anno" + }, + { + "name": "meeting_style" + } + ], + "primaryKey": [ + "company", + "project", + "anno" + ] + } + }, + { + "path": "ddf--datapoints--lines_of_code--by--company--anno.csv", + "name": "lines_of_code--by--company--anno", + "schema": { + "fields": [ + { + "name": "company" + }, + { + "name": "anno" + }, + { + "name": "lines_of_code" + } + ], + "primaryKey": [ + "company", + "anno" + ] + } + }, + { + "path": "ddf--datapoints--lines_of_code--by--company--project--anno.csv", + "name": "lines_of_code--by--company--project--anno", + "schema": { + "fields": [ + { + "name": "company" + }, + { + "name": "project" + }, + { + "name": "anno" + }, + { + "name": "lines_of_code" + } + ], + "primaryKey": [ + "company", + "project", + "anno" + ] + } + }, + { + "path": "ddf--datapoints--lines_of_code--by--company--project.csv", + "name": "lines_of_code--by--company--project", + "schema": { + "fields": [ + { + "name": "company" + }, + { + "name": "project" + }, + { + "name": "lines_of_code" + } + ], + "primaryKey": [ + "company", + "project" + ] + } + }, + { + "path": "ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv", + "name": "meeting_style--popular_appeal--methodology--by--company--project", + "schema": { + "fields": [ + { + "name": "company" + }, + { + "name": "project" + }, + { + "name": "meeting_style" + }, + { + "name": "popular_appeal" + }, + { + "name": "methodology" + } + ], + "primaryKey": [ + "company", + "project" + ] + } + }, + { + "path": "ddf--entities--company--company_scale.csv", + "name": "company--company_scale", + "schema": { + "fields": [ + { + "name": "company_scale" + }, + { + "name": "full_name_changed" + }, + { + "name": "is--company_scale" + } + ], + "primaryKey": "company_scale" + } + }, + { + "path": "ddf--entities--company--english_speaking.csv", + "name": "company--english_speaking", + "schema": { + "fields": [ + { + "name": "company" + }, + { + "name": "name" + }, + { + "name": "country" + }, + { + "name": "region" + }, + { + "name": "additional_column" + }, + { + "name": "is--english_speaking" + } + ], + "primaryKey": "company" + } + }, + { + "path": "ddf--entities--company.csv", + "name": "company", + "schema": { + "fields": [ + { + "name": "company" + }, + { + "name": "name" + }, + { + "name": "country" + }, + { + "name": "region" + }, + { + "name": "additional_column" + }, + { + "name": "is--english_speaking" + } + ], + "primaryKey": "company" + } + }, + { + "path": "ddf--entities--project.csv", + "name": "project", + "schema": { + "fields": [ + { + "name": "project" + }, + { + "name": "name" + } + ], + "primaryKey": "project" + } + }, + { + "path": "ddf--entities--region.csv", + "name": "region", + "schema": { + "fields": [ + { + "name": "region" + }, + { + "name": "full_name_changed" + } + ], + "primaryKey": "region" + } + } + ], + "ddfSchema": { + "datapoints": [ + { + "primaryKey": [ + "english_speaking", + "project", + "anno" + ], + "value": "meeting_style", + "resources": [ + "meeting_style--by--company--project--anno" + ] + }, + { + "primaryKey": [ + "company_scale", + "project", + "anno" + ], + "value": "meeting_style", + "resources": [ + "meeting_style--by--company--project--anno" + ] + }, + { + "primaryKey": [ + "company", + "project", + "anno" + ], + "value": "meeting_style", + "resources": [ + "meeting_style--by--company--project--anno" + ] + }, + { + "primaryKey": [ + "company_scale", + "anno" + ], + "value": "meeting_style", + "resources": [ + "meeting_style--by--company--anno" + ] + }, + { + "primaryKey": [ + "company", + "anno" + ], + "value": "meeting_style", + "resources": [ + "meeting_style--by--company--anno" + ] + }, + { + "primaryKey": [ + "company_scale", + "anno" + ], + "value": "lines_of_code", + "resources": [ + "lines_of_code--by--company_scale--anno" + ] + }, + { + "primaryKey": [ + "company", + "anno" + ], + "value": "lines_of_code", + "resources": [ + "lines_of_code--by--company_scale--anno" + ] + }, + { + "primaryKey": [ + "anno", + "company" + ], + "value": "company_scale", + "resources": [ + "company_scale--by--company--anno" + ] + }, + { + "primaryKey": [ + "anno", + "company" + ], + "value": "lines_of_code", + "resources": [ + "lines_of_code--by--company--anno" + ] + }, + { + "primaryKey": [ + "anno", + "company", + "project" + ], + "value": "lines_of_code", + "resources": [ + "lines_of_code--by--company--project--anno" + ] + }, + { + "primaryKey": [ + "anno", + "english_speaking" + ], + "value": "company_scale", + "resources": [ + "company_scale--by--company--anno" + ] + }, + { + "primaryKey": [ + "anno", + "english_speaking" + ], + "value": "lines_of_code", + "resources": [ + "lines_of_code--by--company--anno" + ] + }, + { + "primaryKey": [ + "anno", + "english_speaking", + "project" + ], + "value": "lines_of_code", + "resources": [ + "lines_of_code--by--company--project--anno" + ] + }, + { + "primaryKey": [ + "company", + "project" + ], + "value": "lines_of_code", + "resources": [ + "lines_of_code--by--company--project" + ] + }, + { + "primaryKey": [ + "company", + "project" + ], + "value": "meeting_style", + "resources": [ + "meeting_style--popular_appeal--methodology--by--company--project" + ] + }, + { + "primaryKey": [ + "company", + "project" + ], + "value": "methodology", + "resources": [ + "meeting_style--popular_appeal--methodology--by--company--project" + ] + }, + { + "primaryKey": [ + "company", + "project" + ], + "value": "popular_appeal", + "resources": [ + "meeting_style--popular_appeal--methodology--by--company--project" + ] + }, + { + "primaryKey": [ + "english_speaking", + "project" + ], + "value": "lines_of_code", + "resources": [ + "lines_of_code--by--company--project" + ] + }, + { + "primaryKey": [ + "english_speaking", + "project" + ], + "value": "meeting_style", + "resources": [ + "meeting_style--popular_appeal--methodology--by--company--project" + ] + }, + { + "primaryKey": [ + "english_speaking", + "project" + ], + "value": "methodology", + "resources": [ + "meeting_style--popular_appeal--methodology--by--company--project" + ] + }, + { + "primaryKey": [ + "english_speaking", + "project" + ], + "value": "popular_appeal", + "resources": [ + "meeting_style--popular_appeal--methodology--by--company--project" + ] + } + ], + "entities": [ + { + "primaryKey": [ + "company" + ], + "value": "additional_column", + "resources": [ + "company" + ] + }, + { + "primaryKey": [ + "company" + ], + "value": "country", + "resources": [ + "company" + ] + }, + { + "primaryKey": [ + "company" + ], + "value": "full_name_changed", + "resources": [ + "company--company_scale" + ] + }, + { + "primaryKey": [ + "company" + ], + "value": "is--company_scale", + "resources": [ + "company--company_scale" + ] + }, + { + "primaryKey": [ + "company" + ], + "value": "is--english_speaking", + "resources": [ + "company" + ] + }, + { + "primaryKey": [ + "company" + ], + "value": "name", + "resources": [ + "company" + ] + }, + { + "primaryKey": [ + "company" + ], + "value": "region", + "resources": [ + "company" + ] + }, + { + "primaryKey": [ + "company_scale" + ], + "value": "full_name_changed", + "resources": [ + "company--company_scale" + ] + }, + { + "primaryKey": [ + "company_scale" + ], + "value": "is--company_scale", + "resources": [ + "company--company_scale" + ] + }, + { + "primaryKey": [ + "english_speaking" + ], + "value": "additional_column", + "resources": [ + "company" + ] + }, + { + "primaryKey": [ + "english_speaking" + ], + "value": "country", + "resources": [ + "company" + ] + }, + { + "primaryKey": [ + "english_speaking" + ], + "value": "is--english_speaking", + "resources": [ + "company" + ] + }, + { + "primaryKey": [ + "english_speaking" + ], + "value": "name", + "resources": [ + "company" + ] + }, + { + "primaryKey": [ + "english_speaking" + ], + "value": "region", + "resources": [ + "company" + ] + }, + { + "primaryKey": [ + "project" + ], + "value": "name", + "resources": [ + "project" + ] + }, + { + "primaryKey": [ + "region" + ], + "value": "full_name_changed", + "resources": [ + "region" + ] + } + ], + "concepts": [ + { + "primaryKey": [ + "concept" + ], + "value": "additional_column", + "resources": [ + "ddf--concepts" + ] + }, + { + "primaryKey": [ + "concept" + ], + "value": "concept_type", + "resources": [ + "ddf--concepts" + ] + }, + { + "primaryKey": [ + "concept" + ], + "value": "domain", + "resources": [ + "ddf--concepts" + ] + } + ] + } +} diff --git a/test/fixtures/companies-nl-ru/ddf--concepts.csv b/test/fixtures/companies-nl-ru/ddf--concepts.csv new file mode 100644 index 0000000..8524c75 --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--concepts.csv @@ -0,0 +1,18 @@ +concept,concept_type,domain,additional_column +company,entity_domain,, +english_speaking,entity_set,company, +company_scale,entity_set,company,updated +name,string,, +anno,time,, +lines_of_code,measure,, +region,entity_domain,, +country,string,, +latitude,measure,, +longitude,measure,, +full_name_changed,string,,new value and change concept +project,entity_domain,, +domain,string,, +additional_column,string,,new row and column +meeting_style,string,, +popular_appeal,string,, +methodology,string,, diff --git a/test/fixtures/companies-nl-ru/ddf--datapoints--company_scale--by--company--anno.csv b/test/fixtures/companies-nl-ru/ddf--datapoints--company_scale--by--company--anno.csv new file mode 100644 index 0000000..4bb905c --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--datapoints--company_scale--by--company--anno.csv @@ -0,0 +1,8 @@ +company,anno,company_scale +mcrsft,1975,small +mcrsft,2016,large +gap,2014,small +gap,2015,medium +gap,2016,small +zsoft,2015,small +zsoft,2016,small diff --git a/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--anno.csv b/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--anno.csv new file mode 100644 index 0000000..c5324fe --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--anno.csv @@ -0,0 +1,6 @@ +company,anno,lines_of_code +mcrsft,2010,31111 +mcrsft,2015,62493 +mcrsft,2016,49595 +gap,2015,496533 +gap,2016,531062 diff --git a/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--project--anno.csv b/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--project--anno.csv new file mode 100644 index 0000000..dd12a6a --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--project--anno.csv @@ -0,0 +1,9 @@ +company,project,anno,lines_of_code +mcrsft,xbox,2016,52222 +gap,vizabi,2015,439549 +gap,vizabi,2016,479679 +gap,ws,2015,56994 +gap,ws,2016,62222 +valor,ws,2015,34857 +valor,ws,2016,11111 +zsoft,ws,2016,22222 diff --git a/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--project.csv b/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--project.csv new file mode 100644 index 0000000..2489078 --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company--project.csv @@ -0,0 +1,8 @@ +company,project,lines_of_code +mcrsft,xbox,3985854 +mcrsft,windows,384584 +mcrsft,office,97473 +gap,vizabi,4893993 +gap,ws,4857 +valor,ws,848547 +zsoft,xbox,10000 diff --git a/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company_scale--anno.csv b/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company_scale--anno.csv new file mode 100644 index 0000000..57f1042 --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--datapoints--lines_of_code--by--company_scale--anno.csv @@ -0,0 +1,4 @@ +company,anno,lines_of_code +small,1975,1000 +medium,2014,10000 +large,2016,100000 diff --git a/test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--by--company--anno.csv b/test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--by--company--anno.csv new file mode 100644 index 0000000..3f03a33 --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--by--company--anno.csv @@ -0,0 +1,4 @@ +company,anno,meeting_style +small,1975,game +medium,2014,brainstorm +large,2016,kanban diff --git a/test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--by--company--project--anno.csv b/test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--by--company--project--anno.csv new file mode 100644 index 0000000..3ed0861 --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--by--company--project--anno.csv @@ -0,0 +1,6 @@ +company,project,anno,meeting_style +small,office,1975,brainstorm +medium,ws,2014,game +large,vizabi,2016,brainstorm +international_house,vizabi,2000,game +it_cluster,vizabi,2010,game diff --git a/test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv b/test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv new file mode 100644 index 0000000..2d7d504 --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv @@ -0,0 +1,6 @@ +company,project,meeting_style,popular_appeal,methodology +mcrsft,xbox,brainstorm,very popular,scrum +gap,vizabi,regular,popular,kanban +gap,ws,game,low popularity,kanban +valor,ws,regular,very popular,lean +zsoft,ws,regular,low popularity,scrum diff --git a/test/fixtures/companies-nl-ru/ddf--entities--company--company_scale.csv b/test/fixtures/companies-nl-ru/ddf--entities--company--company_scale.csv new file mode 100644 index 0000000..ae4a5da --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--entities--company--company_scale.csv @@ -0,0 +1,4 @@ +company_scale,full_name_changed,is--company_scale +small,Not very big,TRUE +large,Very Big,TRUE +medium,medium,TRUE diff --git a/test/fixtures/companies-nl-ru/ddf--entities--company--english_speaking.csv b/test/fixtures/companies-nl-ru/ddf--entities--company--english_speaking.csv new file mode 100644 index 0000000..c16a22e --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--entities--company--english_speaking.csv @@ -0,0 +1,3 @@ +company,name,country,region,additional_column,is--english_speaking +international_house,International House,United States of America,america,any text 1,TRUE +it_cluster,IT Cluster,Sweden,europe,any text 2,TRUE diff --git a/test/fixtures/companies-nl-ru/ddf--entities--company.csv b/test/fixtures/companies-nl-ru/ddf--entities--company.csv new file mode 100644 index 0000000..8bb1d35 --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--entities--company.csv @@ -0,0 +1,5 @@ +company,name,country,region,additional_column,is--english_speaking +mcrsft,Microsoft,United States of America,america,any text 1,TRUE +gap,Gapminder,Sweden,europe,any text 2,TRUE +valor,Valor Sotware,Ukraine,europe,,FALSE +zsoft,Z-Soft,Turkey,asia,,FALSE \ No newline at end of file diff --git a/test/fixtures/companies-nl-ru/ddf--entities--project.csv b/test/fixtures/companies-nl-ru/ddf--entities--project.csv new file mode 100644 index 0000000..7ae9b73 --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--entities--project.csv @@ -0,0 +1,6 @@ +project,name +xbox,Xbox +windows,Windows +office,Office +vizabi,Vizabi +ws,Waffle Server diff --git a/test/fixtures/companies-nl-ru/ddf--entities--region.csv b/test/fixtures/companies-nl-ru/ddf--entities--region.csv new file mode 100644 index 0000000..61fe80f --- /dev/null +++ b/test/fixtures/companies-nl-ru/ddf--entities--region.csv @@ -0,0 +1,4 @@ +region,full_name_changed +america,"The Americas, including north, south and central america" +europe,The European part of Eurasia +asia,Asia part of Eurasia Updated diff --git a/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--concepts.csv b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--concepts.csv new file mode 100644 index 0000000..a6ca039 --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--concepts.csv @@ -0,0 +1,15 @@ +concept,concept_type,domain,additional_column +company,entity_domain,,bedrijf +english_speaking,entity_set,company,Engels sprekende +company_scale,entity_set,company,company_scale +name,string,,naam +anno,time,,anno +lines_of_code,measure,,lines_of_code +region,entity_domain,,regio +country,string,,land +latitude,measure,,breedtegraad +longitude,measure,,Lengtegraad +full_name_changed,string,,FULL_NAME verandering +project,entity_domain,,project +domain,string,,domein +additional_column,string,,extra kolom diff --git a/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--datapoints--company_scale--by--company--anno.csv b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--datapoints--company_scale--by--company--anno.csv new file mode 100644 index 0000000..34cd528 --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--datapoints--company_scale--by--company--anno.csv @@ -0,0 +1,8 @@ +company,anno,company_scale +mcrsft,1975,klein +mcrsft,2016,groot +gap,2014,klein +gap,2015,middelgroot +gap,2016,klein +zsoft,2015,klein +zsoft,2016,klein diff --git a/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv new file mode 100644 index 0000000..9074847 --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv @@ -0,0 +1,6 @@ +company,project,meeting_style,methodology,popular_appeal +mcrsft,xbox,brainstorm,worsteling om de bal,hoog +gap,vizabi,regelmatig,kanban,normaal +gap,ws,spel-gebaseerde,kanban,laag +valor,ws,regelmatig,mager,hoog +zsoft,ws,regelmatig,worsteling om de bal,laag diff --git a/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--company--company_scale.csv b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--company--company_scale.csv new file mode 100644 index 0000000..0b50b2a --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--company--company_scale.csv @@ -0,0 +1,4 @@ +company_scale,full_name_changed,is--company_scale +small,Niet heel groot,TRUE +large,HEEL GROOT!!!$(#(*#*($,TRUE +medium,middelgroot,TRUE diff --git a/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--company.csv b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--company.csv new file mode 100644 index 0000000..7c7b3ba --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--company.csv @@ -0,0 +1,5 @@ +company,name,country,region,additional_column,is--english_speaking +mcrsft,Microsoft,de Verenigde Staten van Amerika,america,any text 1,TRUE +zsoft,Z-Soft,Turkije,asia,,FALSE +gap,Gapminder,Zweden,europe,any text 2,TRUE +valor,Valor Software,Oekraïne,europe,,FALSE diff --git a/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--region.csv b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--region.csv new file mode 100644 index 0000000..60198fc --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/nl-nl/ddf--entities--region.csv @@ -0,0 +1,4 @@ +region,full_name_changed +america,"Amerika, met inbegrip van het noorden, zuiden en Midden-Amerika" +europe,Het Europese deel van Eurazië +asia,Asia deel van Eurazië Bijgewerkt diff --git a/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--concepts.csv b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--concepts.csv new file mode 100644 index 0000000..7e7dae1 --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--concepts.csv @@ -0,0 +1,12 @@ +concept,concept_type,domain,additional_column +company,entity_domain,,компания +english_speaking,entity_set,company,англоязычная +name,string,,название +lines_of_code,measure,,строк_кода +region,entity_domain,,регион +country,string,,страна +latitude,measure,,широта +longitude,measure,,долгота +full_name_changed,string,,полное название +project,entity_domain,,проект +additional_column,string,,дополнительный столбец diff --git a/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--datapoints--company_scale--by--company--anno.csv b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--datapoints--company_scale--by--company--anno.csv new file mode 100644 index 0000000..c3b558e --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--datapoints--company_scale--by--company--anno.csv @@ -0,0 +1,8 @@ +company,anno,company_scale +mcrsft,1975,малая +mcrsft,2016,большая +gap,2014,малая +gap,2015,средняя +gap,2016,малая +zsoft,2015,малая +zsoft,2016,малая diff --git a/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv new file mode 100644 index 0000000..38bdba3 --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--datapoints--meeting_style--popular_appeal--methodology--by--company--project.csv @@ -0,0 +1,6 @@ +company,project,meeting_style,popular_appeal,methodology +mcrsft,xbox,мозгштурм,очпопулярный,скрам +gap,vizabi,обычный,популярный,канбан +gap,ws,игра,непопулярный,канбан +valor,ws,обычный,очпопулярный,лин +zsoft,ws,обычный,непопулярный,скрам diff --git a/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--company--company_scale.csv b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--company--company_scale.csv new file mode 100644 index 0000000..9b2dc8f --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--company--company_scale.csv @@ -0,0 +1,4 @@ +company_scale,full_name_changed,is--company_scale +small,Малая,TRUE +large,Очень большая,TRUE +medium,Средняя,TRUE diff --git a/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--company.csv b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--company.csv new file mode 100644 index 0000000..43c6644 --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--company.csv @@ -0,0 +1,5 @@ +company,name,country,region,additional_column,is--english_speaking +mcrsft,Microsoft,США,america,any text 1,TRUE +gap,Gapminder,Швеция,europe,any text 2,TRUE +valor,Valor Sotware,Украина,europe,,FALSE +zsoft,Z-Soft,Турция,asia,,FALSE \ No newline at end of file diff --git a/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--region.csv b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--region.csv new file mode 100644 index 0000000..c353185 --- /dev/null +++ b/test/fixtures/companies-nl-ru/lang/ru-ru/ddf--entities--region.csv @@ -0,0 +1,4 @@ +region,full_name_changed +america,Америка +europe,Европа +asia,Азия diff --git a/test/translation-rules.spec.ts b/test/translation-rules.spec.ts index 3f06400..32173a7 100644 --- a/test/translation-rules.spec.ts +++ b/test/translation-rules.spec.ts @@ -213,6 +213,33 @@ describe('translation rules', () => { dataPointChunksProcessingStory.withCustomRules(customRules).waitForResult(theEnd).processDataPointChunks(ddfDataSet, issuesFilter); }); }); + + it('any issue should NOT be found for "fixtures/companies-nl-ru"', done => { + const ddfDataSet = new DdfDataSet('./test/fixtures/companies-nl-ru', null); + const issueEmitter = new EventEmitter(); + const issues: Issue[] = []; + + ddfDataSet.load(() => { + const fileDescriptorsChunks = getAllDataPointFileDescriptorsChunks(ddfDataSet); + const theEnd = () => { + expect(issues.length).to.equal(0); + + done(); + }; + + issueEmitter.on('issue', (issue) => { + issues.push(issue); + }); + const customRules = [{ + ruleKey: DUPLICATED_DATA_POINT_TRANSLATION_KEY, + rule: allRules[DUPLICATED_DATA_POINT_TRANSLATION_KEY] + }]; + + const dataPointChunksProcessingStory = new DataPointChunksProcessingStory(fileDescriptorsChunks, issueEmitter); + + dataPointChunksProcessingStory.withCustomRules(customRules).waitForResult(theEnd).processDataPointChunks(ddfDataSet, issuesFilter); + }); + }); }); describe('when "DUPLICATED_TRANSLATION_KEY" rule', () => {