mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-08 06:22:53 +00:00
test: add test to make sure there are no duplicate names
This commit is contained in:
committed by
Rainer Killinger
parent
aa294c4e29
commit
e8d492a18a
44
test/compat.spec.ts
Normal file
44
test/compat.spec.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 StApps
|
||||||
|
* This program is free software: you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the Free
|
||||||
|
* Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {lightweightProjectFromPath} from '@openstapps/core-tools/lib/easy-ast/easy-ast';
|
||||||
|
import {LightweightProject} from '@openstapps/core-tools/lib/easy-ast/types/lightweight-project';
|
||||||
|
import {expect} from 'chai';
|
||||||
|
import {reduce} from 'lodash';
|
||||||
|
|
||||||
|
process.on('unhandledRejection', (err) => {
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Mapping Compatibility', () => {
|
||||||
|
let project: LightweightProject;
|
||||||
|
|
||||||
|
before(function () {
|
||||||
|
this.timeout(15000);
|
||||||
|
this.slow(10000);
|
||||||
|
|
||||||
|
project = lightweightProjectFromPath('src');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('non-exported definitions should not have duplicate names across files', () => {
|
||||||
|
reduce(project, (result, file) => reduce(file, (result2, _, key) => {
|
||||||
|
expect(result2[key]).to.be.undefined;
|
||||||
|
return {
|
||||||
|
[key]: true,
|
||||||
|
...result2,
|
||||||
|
};
|
||||||
|
}, result), {} as Record<string, boolean>);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user