Add flag to update all extensions (#7321)

This commit is contained in:
christine betts
2025-08-29 17:24:17 +00:00
committed by GitHub
parent 6a9fb6d2ea
commit af6a792caa
3 changed files with 73 additions and 32 deletions
+2 -8
View File
@@ -635,13 +635,11 @@ describe('updateExtension', () => {
});
it('should update a git-installed extension', async () => {
// 1. "Install" an extension
const gitUrl = 'https://github.com/google/gemini-extensions.git';
const extensionName = 'gemini-extensions';
const targetExtDir = path.join(userExtensionsDir, extensionName);
const metadataPath = path.join(targetExtDir, INSTALL_METADATA_FILENAME);
// Create the "installed" extension directory and files
fs.mkdirSync(targetExtDir, { recursive: true });
fs.writeFileSync(
path.join(targetExtDir, EXTENSIONS_CONFIG_FILENAME),
@@ -652,10 +650,8 @@ describe('updateExtension', () => {
JSON.stringify({ source: gitUrl, type: 'git' }),
);
// 2. Mock the git clone for the update
const clone = vi.fn().mockImplementation(async (_, destination) => {
fs.mkdirSync(destination, { recursive: true });
// This is the "updated" version
fs.writeFileSync(
path.join(destination, EXTENSIONS_CONFIG_FILENAME),
JSON.stringify({ name: extensionName, version: '1.1.0' }),
@@ -667,16 +663,14 @@ describe('updateExtension', () => {
clone,
} as unknown as SimpleGit);
// 3. Call updateExtension
const updateInfo = await updateExtension(extensionName);
const updateInfo = await updateExtension(loadExtension(targetExtDir));
// 4. Assertions
expect(updateInfo).toEqual({
name: 'gemini-extensions',
originalVersion: '1.0.0',
updatedVersion: '1.1.0',
});
// Check that the config file reflects the new version
const updatedConfig = JSON.parse(
fs.readFileSync(
path.join(targetExtDir, EXTENSIONS_CONFIG_FILENAME),