test: seed cli status in extensions install tests
This commit is contained in:
parent
9f7cfb04fa
commit
0e1381ce37
1 changed files with 22 additions and 0 deletions
|
|
@ -262,6 +262,17 @@ describe('extensionsSlice', () => {
|
||||||
|
|
||||||
describe('installPlugin', () => {
|
describe('installPlugin', () => {
|
||||||
it('sets progress to pending then success', async () => {
|
it('sets progress to pending then success', async () => {
|
||||||
|
store.setState({
|
||||||
|
cliStatus: {
|
||||||
|
installed: true,
|
||||||
|
installedVersion: '1.0.0',
|
||||||
|
binaryPath: '/usr/local/bin/claude',
|
||||||
|
latestVersion: '1.0.0',
|
||||||
|
updateAvailable: false,
|
||||||
|
authLoggedIn: true,
|
||||||
|
authMethod: 'oauth_token',
|
||||||
|
},
|
||||||
|
});
|
||||||
const plugins = [makePlugin({ pluginId: 'a@m' })];
|
const plugins = [makePlugin({ pluginId: 'a@m' })];
|
||||||
(api.plugins!.getAll as ReturnType<typeof vi.fn>).mockResolvedValue(plugins);
|
(api.plugins!.getAll as ReturnType<typeof vi.fn>).mockResolvedValue(plugins);
|
||||||
(api.plugins!.install as ReturnType<typeof vi.fn>).mockResolvedValue({ state: 'success' });
|
(api.plugins!.install as ReturnType<typeof vi.fn>).mockResolvedValue({ state: 'success' });
|
||||||
|
|
@ -276,6 +287,17 @@ describe('extensionsSlice', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sets progress to error on failure', async () => {
|
it('sets progress to error on failure', async () => {
|
||||||
|
store.setState({
|
||||||
|
cliStatus: {
|
||||||
|
installed: true,
|
||||||
|
installedVersion: '1.0.0',
|
||||||
|
binaryPath: '/usr/local/bin/claude',
|
||||||
|
latestVersion: '1.0.0',
|
||||||
|
updateAvailable: false,
|
||||||
|
authLoggedIn: true,
|
||||||
|
authMethod: 'oauth_token',
|
||||||
|
},
|
||||||
|
});
|
||||||
(api.plugins!.install as ReturnType<typeof vi.fn>).mockResolvedValue({
|
(api.plugins!.install as ReturnType<typeof vi.fn>).mockResolvedValue({
|
||||||
state: 'error',
|
state: 'error',
|
||||||
error: 'Not found',
|
error: 'Not found',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue