mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 17:42:57 +00:00
feat: tests
This commit is contained in:
@@ -13,41 +13,31 @@
|
||||
* 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 {lightweightProjectFromPath, LightweightProject} from '@openstapps/easy-ast';
|
||||
import {expect} from 'chai';
|
||||
import {reduce} from 'lodash';
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
throw err;
|
||||
process.on('unhandledRejection', error => {
|
||||
throw error;
|
||||
});
|
||||
|
||||
describe('Mapping Compatibility', () => {
|
||||
let project: LightweightProject;
|
||||
|
||||
before(function () {
|
||||
this.timeout(15000);
|
||||
this.slow(10000);
|
||||
this.timeout(15_000);
|
||||
this.slow(10_000);
|
||||
|
||||
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>,
|
||||
);
|
||||
const names = new Set<string>();
|
||||
|
||||
for (const file in project) {
|
||||
for (const definition in project[file]) {
|
||||
expect(names).not.to.include(definition);
|
||||
names.add(definition);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user