Skip to content

Commit d13fb56

Browse files
committed
test: consolidate source excerpt coverage
1 parent 9b92c11 commit d13fb56

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

packages/experience-design-system-cli/test/session/source-excerpt.test.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,7 @@ describe('excerptAroundNames', () => {
5656
expect(result.usesNotShown).toEqual(['padding']);
5757
});
5858

59-
// In a source file the declaration comes first and the use comes last:
60-
// `fontColor?: ColorTokens` in the props interface, then a default in the
61-
// destructuring, then `color: tokens[fontColor]` in the style. Under a tight
62-
// budget the use is the line that decides classification, so later windows
63-
// must be kept in preference to earlier ones.
64-
it('prefers the last occurrence of a name over its declaration when the budget cannot hold both', () => {
59+
it('prefers the last occurrence of a name over its declaration without falsely reporting it cut', () => {
6560
const text = [
6661
'export interface TextProps {',
6762
' fontColor?: ColorTokens;',
@@ -75,22 +70,6 @@ describe('excerptAroundNames', () => {
7570
const result = excerptAroundNames(text, ['fontColor'], 100, 1);
7671
expect(result.content).toContain('color: tokens[fontColor],');
7772
expect(result.content).not.toContain('fontColor?: ColorTokens;');
78-
});
79-
80-
// The note exists to say "the line that decides this prop is missing". A
81-
// cut declaration while the use is shown is not that, so it must not fire.
82-
it('does not report a name whose last occurrence is shown even when an earlier one was cut', () => {
83-
const text = [
84-
'export interface TextProps {',
85-
' fontColor?: ColorTokens;',
86-
'}',
87-
filler(40, 'const between'),
88-
'const styles = css({',
89-
' color: tokens[fontColor],',
90-
'});',
91-
].join('\n');
92-
const result = excerptAroundNames(text, ['fontColor'], 100, 1);
93-
expect(result.content).toContain('color: tokens[fontColor],');
9473
expect(result.usesNotShown).toEqual([]);
9574
});
9675

0 commit comments

Comments
 (0)