feat: tests

This commit is contained in:
2023-04-21 12:08:35 +02:00
parent 8cb9285462
commit d8c79256c9
140 changed files with 2100 additions and 2693 deletions

View File

@@ -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);
}
}
});
});