Skip to content

Commit bf3c93c

Browse files
committed
test: verify teamcity truncated dataset labels match static analysis IDs
Add tests confirming that truncated tuple labels with ellipsis (…) and deduplicated suffixes (#1, #2) from teamcity output correctly match the IDs generated by static analysis.
1 parent b8c3c20 commit bf3c93c

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

packages/phpunit/src/TestParser/TestDefinitionBuilder.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,48 @@ describe('resolveDatasetDefinition', () => {
8585
expect(result?.id).toBe(`${parent.id} with data set "('Office') / ('Saturday')"`);
8686
expect(result?.label).toBe(`with ('Office') / ('Saturday')`);
8787
});
88+
89+
it('should handle truncated tuple with ellipsis from teamcity', () => {
90+
const result = resolveDatasetDefinition(
91+
'it has many args with data set "(1, 2, 3, …)"',
92+
parent,
93+
);
94+
95+
expect(result).toBeDefined();
96+
expect(result?.id).toBe(`${parent.id} with data set "(1, 2, 3, …)"`);
97+
expect(result?.label).toBe('with (1, 2, 3, …)');
98+
});
99+
100+
it('should handle deduplicated truncated tuple from teamcity', () => {
101+
const result1 = resolveDatasetDefinition(
102+
'it same prefix with data set "(1, 2, 3, …) #1"',
103+
parent,
104+
);
105+
const result2 = resolveDatasetDefinition(
106+
'it same prefix with data set "(1, 2, 3, …) #2"',
107+
parent,
108+
);
109+
110+
expect(result1).toBeDefined();
111+
expect(result2).toBeDefined();
112+
expect(result1?.id).not.toBe(result2?.id);
113+
expect(result1?.id).toBe(`${parent.id} with data set "(1, 2, 3, …) #1"`);
114+
expect(result2?.id).toBe(`${parent.id} with data set "(1, 2, 3, …) #2"`);
115+
});
116+
117+
it('teamcity truncated id matches statically analyzed id', () => {
118+
// Static analysis creates: parent.id + " with " + label
119+
const staticLabel = 'data set "(1, 2, 3, …)"';
120+
const staticDef = createDatasetDefinition(parent, staticLabel);
121+
122+
// Teamcity returns: "methodName with data set "(1, 2, 3, …)""
123+
const teamcityDef = resolveDatasetDefinition(
124+
`addition_provider with data set "(1, 2, 3, …)"`,
125+
parent,
126+
);
127+
128+
expect(staticDef.id).toBe(teamcityDef?.id);
129+
});
88130
});
89131

90132
describe('createDatasetDefinition', () => {

0 commit comments

Comments
 (0)