From 66c57162aa2827af6fd37f1c56dd37d4d6fe2a64 Mon Sep 17 00:00:00 2001 From: Johannes <johannes.rieken@gmail.com> Date: Thu, 12 Sep 2024 08:44:15 +0200 Subject: [PATCH] add failing test for https://github.com/microsoft/vscode-copilot/issues/8093 --- src/base/test/renderer.test.tsx | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/base/test/renderer.test.tsx b/src/base/test/renderer.test.tsx index a26ca90..f988542 100644 --- a/src/base/test/renderer.test.tsx +++ b/src/base/test/renderer.test.tsx @@ -1129,6 +1129,46 @@ LOW MED 00 01 02 03 04 05 06 07 08 09 ); }) + test.skip('none-grow, greedy-grow, grow elements, nested', async () => { + + class StringEchoBudget extends PromptElement<IProps, number> { + prepare(sizing: PromptSizing): Promise<number> { + return Promise.resolve(sizing.tokenBudget); + } + render(budget: number) { + return ( + <> + {this.props.useBudget ? `consume=${this.props.useBudget}, ` : ''} + {this.props.name}={budget} + </> + ); + } + } + + await flexTest(<> + <UserMessage> + <StringEchoBudget name='1' useBudget={5} /> + <StringEchoBudget name='2' useBudget={10} /> + <StringEchoBudget name='3' useBudget={5} /> + <StringEchoBudget name='grow4' flexGrow={2} useBudget={1} /> + <StringEchoBudget name='grow5' flexGrow={3} useBudget={79} /> + </UserMessage> + </>, + [ + { + content: [ + 'consume=5, 1=33', + 'consume=10, 2=33', + 'consume=5, 3=33', + 'consume=1, grow4=1', + 'consume=79, grow5=80' + ].join('\n'), + role: ChatRole.User, + } + ] + ); + }) + test('counts budget used in nested elements', async () => { class Nested extends PromptElement { render() {