-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from projectatomic/feat/reactive-catalog
push the catalog to the frontend and use a store on frontend
- Loading branch information
Showing
14 changed files
with
201 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { vi, test, expect } from 'vitest'; | ||
import { screen, render } from '@testing-library/svelte'; | ||
import Model from './Model.svelte'; | ||
import catalog from '../../../backend/src/ai-user-test.json'; | ||
|
||
const mocks = vi.hoisted(() => { | ||
return { | ||
getCatalogMock: vi.fn(), | ||
}; | ||
}); | ||
|
||
vi.mock('../utils/client', async () => { | ||
return { | ||
studioClient: { | ||
getCatalog: mocks.getCatalogMock, | ||
}, | ||
rpcBrowser: { | ||
subscribe: () => { | ||
return { | ||
unsubscribe: () => {}, | ||
}; | ||
}, | ||
}, | ||
}; | ||
}); | ||
|
||
test('should display model information', async () => { | ||
const model = catalog.models.find(m => m.id === 'model1'); | ||
expect(model).not.toBeUndefined(); | ||
|
||
mocks.getCatalogMock.mockResolvedValue(catalog); | ||
render(Model, { | ||
modelId: 'model1', | ||
}); | ||
await new Promise(resolve => setTimeout(resolve, 200)); | ||
|
||
screen.getByText(model!.name); | ||
screen.getByText(model!.description); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { vi, test, expect } from 'vitest'; | ||
import { screen, render } from '@testing-library/svelte'; | ||
import catalog from '../../../backend/src/ai-user-test.json'; | ||
import Recipe from './Recipe.svelte'; | ||
|
||
const mocks = vi.hoisted(() => { | ||
return { | ||
getCatalogMock: vi.fn(), | ||
}; | ||
}); | ||
|
||
vi.mock('../utils/client', async () => { | ||
return { | ||
studioClient: { | ||
getCatalog: mocks.getCatalogMock, | ||
}, | ||
rpcBrowser: { | ||
subscribe: () => { | ||
return { | ||
unsubscribe: () => {}, | ||
}; | ||
}, | ||
}, | ||
}; | ||
}); | ||
|
||
test('should display recipe information', async () => { | ||
const recipe = catalog.recipes.find(r => r.id === 'recipe 1'); | ||
expect(recipe).not.toBeUndefined(); | ||
|
||
mocks.getCatalogMock.mockResolvedValue(catalog); | ||
render(Recipe, { | ||
recipeId: 'recipe 1', | ||
}); | ||
await new Promise(resolve => setTimeout(resolve, 200)); | ||
|
||
screen.getByText(recipe!.name); | ||
screen.getByText(recipe!.readme); | ||
}); |
Oops, something went wrong.