test(ngcc): use isNamedDeclaration()
helper to simplify tests (#38959)
Previously these tests were checking multiple specific expression types. The new helper function is more general and will also support `PropertyAccessExpression` nodes for `InlineDeclaration` types. PR Close #38959
This commit is contained in:

committed by
atscott

parent
0accd1e68d
commit
47eab61cad
@ -10,8 +10,8 @@ import * as ts from 'typescript';
|
||||
import {absoluteFrom, AbsoluteFsPath, getSourceFileOrError} from '../../../src/ngtsc/file_system';
|
||||
import {runInEachFileSystem, TestFile} from '../../../src/ngtsc/file_system/testing';
|
||||
import {MockLogger} from '../../../src/ngtsc/logging/testing';
|
||||
import {DeclarationNode, isNamedClassDeclaration, isNamedVariableDeclaration} from '../../../src/ngtsc/reflection';
|
||||
import {getDeclaration} from '../../../src/ngtsc/testing';
|
||||
import {DeclarationNode} from '../../../src/ngtsc/reflection';
|
||||
import {getDeclaration, isNamedDeclaration} from '../../../src/ngtsc/testing';
|
||||
import {loadTestFiles} from '../../../test/helpers';
|
||||
import {ModuleWithProvidersAnalyses, ModuleWithProvidersAnalyzer} from '../../src/analysis/module_with_providers_analyzer';
|
||||
import {NgccReferencesRegistry} from '../../src/analysis/ngcc_references_registry';
|
||||
@ -661,9 +661,7 @@ runInEachFileSystem(() => {
|
||||
}
|
||||
|
||||
function getName(node: DeclarationNode|null): string {
|
||||
return node && (isNamedVariableDeclaration(node) || isNamedClassDeclaration(node)) ?
|
||||
`${node.name.text}.` :
|
||||
'';
|
||||
return node && isNamedDeclaration(node) ? `${node.name.text}.` : '';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user