mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix: integration tests (#1062)
This commit is contained in:
@@ -21,23 +21,21 @@ describe('Interactive Mode', () => {
|
|||||||
it.skipIf(process.platform === 'win32')(
|
it.skipIf(process.platform === 'win32')(
|
||||||
'should trigger chat compression with /compress command',
|
'should trigger chat compression with /compress command',
|
||||||
async () => {
|
async () => {
|
||||||
await rig.setup('interactive-compress-test');
|
await rig.setup('interactive-compress-test', {
|
||||||
|
settings: {
|
||||||
|
security: {
|
||||||
|
auth: {
|
||||||
|
selectedType: 'openai',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const { ptyProcess } = rig.runInteractive();
|
const { ptyProcess } = rig.runInteractive();
|
||||||
|
|
||||||
let fullOutput = '';
|
let fullOutput = '';
|
||||||
ptyProcess.onData((data) => (fullOutput += data));
|
ptyProcess.onData((data) => (fullOutput += data));
|
||||||
|
|
||||||
const authDialogAppeared = await rig.waitForText(
|
|
||||||
'How would you like to authenticate',
|
|
||||||
5000,
|
|
||||||
);
|
|
||||||
|
|
||||||
// select the second option if auth dialog come's up
|
|
||||||
if (authDialogAppeared) {
|
|
||||||
ptyProcess.write('2');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait for the app to be ready
|
// Wait for the app to be ready
|
||||||
const isReady = await rig.waitForText('Type your message', 15000);
|
const isReady = await rig.waitForText('Type your message', 15000);
|
||||||
expect(
|
expect(
|
||||||
@@ -71,23 +69,21 @@ describe('Interactive Mode', () => {
|
|||||||
it.skipIf(process.platform === 'win32')(
|
it.skipIf(process.platform === 'win32')(
|
||||||
'should handle compression failure on token inflation',
|
'should handle compression failure on token inflation',
|
||||||
async () => {
|
async () => {
|
||||||
await rig.setup('interactive-compress-test');
|
await rig.setup('interactive-compress-test', {
|
||||||
|
settings: {
|
||||||
|
security: {
|
||||||
|
auth: {
|
||||||
|
selectedType: 'openai',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const { ptyProcess } = rig.runInteractive();
|
const { ptyProcess } = rig.runInteractive();
|
||||||
|
|
||||||
let fullOutput = '';
|
let fullOutput = '';
|
||||||
ptyProcess.onData((data) => (fullOutput += data));
|
ptyProcess.onData((data) => (fullOutput += data));
|
||||||
|
|
||||||
const authDialogAppeared = await rig.waitForText(
|
|
||||||
'How would you like to authenticate',
|
|
||||||
5000,
|
|
||||||
);
|
|
||||||
|
|
||||||
// select the second option if auth dialog come's up
|
|
||||||
if (authDialogAppeared) {
|
|
||||||
ptyProcess.write('2');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait for the app to be ready
|
// Wait for the app to be ready
|
||||||
const isReady = await rig.waitForText('Type your message', 25000);
|
const isReady = await rig.waitForText('Type your message', 25000);
|
||||||
expect(
|
expect(
|
||||||
@@ -106,7 +102,7 @@ describe('Interactive Mode', () => {
|
|||||||
expect(foundEvent).toBe(true);
|
expect(foundEvent).toBe(true);
|
||||||
|
|
||||||
const compressionFailed = await rig.waitForText(
|
const compressionFailed = await rig.waitForText(
|
||||||
'compression was not beneficial',
|
'Nothing to compress.',
|
||||||
25000,
|
25000,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -22,21 +22,19 @@ describe('Interactive file system', () => {
|
|||||||
'should perform a read-then-write sequence in interactive mode',
|
'should perform a read-then-write sequence in interactive mode',
|
||||||
async () => {
|
async () => {
|
||||||
const fileName = 'version.txt';
|
const fileName = 'version.txt';
|
||||||
await rig.setup('interactive-read-then-write');
|
await rig.setup('interactive-read-then-write', {
|
||||||
|
settings: {
|
||||||
|
security: {
|
||||||
|
auth: {
|
||||||
|
selectedType: 'openai',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
rig.createFile(fileName, '1.0.0');
|
rig.createFile(fileName, '1.0.0');
|
||||||
|
|
||||||
const { ptyProcess } = rig.runInteractive();
|
const { ptyProcess } = rig.runInteractive();
|
||||||
|
|
||||||
const authDialogAppeared = await rig.waitForText(
|
|
||||||
'How would you like to authenticate',
|
|
||||||
5000,
|
|
||||||
);
|
|
||||||
|
|
||||||
// select the second option if auth dialog come's up
|
|
||||||
if (authDialogAppeared) {
|
|
||||||
ptyProcess.write('2');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait for the app to be ready
|
// Wait for the app to be ready
|
||||||
const isReady = await rig.waitForText('Type your message', 15000);
|
const isReady = await rig.waitForText('Type your message', 15000);
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export function CompressionMessage({
|
|||||||
case CompressionStatus.COMPRESSION_FAILED_TOKEN_COUNT_ERROR:
|
case CompressionStatus.COMPRESSION_FAILED_TOKEN_COUNT_ERROR:
|
||||||
return 'Could not compress chat history due to a token counting error.';
|
return 'Could not compress chat history due to a token counting error.';
|
||||||
case CompressionStatus.NOOP:
|
case CompressionStatus.NOOP:
|
||||||
return 'Chat history is already compressed.';
|
return 'Nothing to compress.';
|
||||||
default:
|
default:
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user