integration tests

This commit is contained in:
2026-01-24 00:18:44 +01:00
parent f8099f04bc
commit c470505b4f
3 changed files with 75 additions and 65 deletions

View File

@@ -3,8 +3,9 @@
*
* View Data Builders in lib/builders/view-data/ must:
* 1. Be classes named *ViewDataBuilder
* 2. Implement the ViewDataBuilder<TInput, TOutput> interface
* 3. Have a static build() method
* 2. Have a static build() method
*
* Note: 'implements' is deprecated in favor of 'satisfies' checked in view-data-builder-contract.js
*/
module.exports = {
@@ -19,7 +20,6 @@ module.exports = {
schema: [],
messages: {
notAClass: 'View Data Builders must be classes named *ViewDataBuilder',
missingImplements: 'View Data Builders must implement ViewDataBuilder<TInput, TOutput> interface',
missingBuildMethod: 'View Data Builders must have a static build() method',
},
},
@@ -30,7 +30,6 @@ module.exports = {
if (!isInViewDataBuilders) return {};
let hasImplements = false;
let hasBuildMethod = false;
return {
@@ -45,24 +44,6 @@ module.exports = {
});
}
// Check if class implements ViewDataBuilder interface
if (node.implements && node.implements.length > 0) {
for (const impl of node.implements) {
// Handle GenericTypeAnnotation for ViewDataBuilder<TInput, TOutput>
if (impl.expression.type === 'TSInstantiationExpression') {
const expr = impl.expression.expression;
if (expr.type === 'Identifier' && expr.name === 'ViewDataBuilder') {
hasImplements = true;
}
} else if (impl.expression.type === 'Identifier') {
// Handle simple ViewDataBuilder (without generics)
if (impl.expression.name === 'ViewDataBuilder') {
hasImplements = true;
}
}
}
}
// Check for static build method
const buildMethod = node.body.body.find(member =>
member.type === 'MethodDefinition' &&
@@ -77,13 +58,6 @@ module.exports = {
},
'Program:exit'() {
if (!hasImplements) {
context.report({
node: context.getSourceCode().ast,
messageId: 'missingImplements',
});
}
if (!hasBuildMethod) {
context.report({
node: context.getSourceCode().ast,