fix: queue issue
This commit is contained in:
@@ -105,7 +105,7 @@ describe('AnimeSettingsManager', () => {
|
||||
getToken: vi.fn(() => 'fake-jwt-token'),
|
||||
checkAuth: vi.fn().mockResolvedValue(true),
|
||||
},
|
||||
UiUtils: {
|
||||
UI: {
|
||||
showToast: vi.fn(),
|
||||
},
|
||||
};
|
||||
@@ -226,7 +226,7 @@ describe('AnimeSettingsManager', () => {
|
||||
it('handles 401 by calling showError', async () => {
|
||||
mockFetchSequence([{ status: 401, body: { detail: 'unauthorized' } }]);
|
||||
await manager.loadSeries('whatever');
|
||||
expect(global.AniWorld.UiUtils.showToast).toHaveBeenCalledWith(
|
||||
expect(global.AniWorld.UI.showToast).toHaveBeenCalledWith(
|
||||
expect.stringContaining('authenticated'),
|
||||
'error'
|
||||
);
|
||||
@@ -297,7 +297,7 @@ describe('AnimeSettingsManager', () => {
|
||||
body: { key: 'a', name: 'New Name' },
|
||||
}]);
|
||||
await manager.saveSettings({ applyToNfo: false });
|
||||
expect(global.AniWorld.UiUtils.showToast).toHaveBeenCalledWith(
|
||||
expect(global.AniWorld.UI.showToast).toHaveBeenCalledWith(
|
||||
expect.stringContaining('saved'),
|
||||
'success'
|
||||
);
|
||||
@@ -309,7 +309,7 @@ describe('AnimeSettingsManager', () => {
|
||||
body: { key: 'a', name: 'New Name', has_nfo: true },
|
||||
}]);
|
||||
await manager.saveSettings({ applyToNfo: true });
|
||||
expect(global.AniWorld.UiUtils.showToast).toHaveBeenCalledWith(
|
||||
expect(global.AniWorld.UI.showToast).toHaveBeenCalledWith(
|
||||
expect.stringContaining('regenerated'),
|
||||
'success'
|
||||
);
|
||||
@@ -318,7 +318,7 @@ describe('AnimeSettingsManager', () => {
|
||||
it('shows error toast on 422', async () => {
|
||||
mockFetchSequence([{ status: 422, body: { detail: 'bad tmdb_id' } }]);
|
||||
await manager.saveSettings({ applyToNfo: false });
|
||||
expect(global.AniWorld.UiUtils.showToast).toHaveBeenCalledWith(
|
||||
expect(global.AniWorld.UI.showToast).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Validation'),
|
||||
'error'
|
||||
);
|
||||
@@ -359,7 +359,7 @@ describe('AnimeSettingsManager', () => {
|
||||
const [url, opts] = global.fetch.mock.calls[0];
|
||||
expect(url).toBe('/api/anime/a/regenerate-nfo');
|
||||
expect(opts.method).toBe('POST');
|
||||
expect(global.AniWorld.UiUtils.showToast).toHaveBeenCalledWith(
|
||||
expect(global.AniWorld.UI.showToast).toHaveBeenCalledWith(
|
||||
'NFO regenerated.',
|
||||
'success'
|
||||
);
|
||||
@@ -368,7 +368,7 @@ describe('AnimeSettingsManager', () => {
|
||||
it('shows error toast on 400 (no tmdb_id)', async () => {
|
||||
mockFetchSequence([{ status: 400, body: { detail: 'no TMDB ID' } }]);
|
||||
await manager.regenerateNfo();
|
||||
expect(global.AniWorld.UiUtils.showToast).toHaveBeenCalledWith(
|
||||
expect(global.AniWorld.UI.showToast).toHaveBeenCalledWith(
|
||||
expect.stringContaining('Cannot regenerate'),
|
||||
'error'
|
||||
);
|
||||
@@ -467,18 +467,18 @@ describe('AnimeSettingsManager', () => {
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
describe('showSaveSuccess()', () => {
|
||||
it('calls AniWorld.UiUtils.showToast with success type', () => {
|
||||
it('calls AniWorld.UI.showToast with success type', () => {
|
||||
manager.showSaveSuccess('Saved!');
|
||||
expect(global.AniWorld.UiUtils.showToast).toHaveBeenCalledWith(
|
||||
expect(global.AniWorld.UI.showToast).toHaveBeenCalledWith(
|
||||
'Saved!', 'success'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('showError()', () => {
|
||||
it('calls AniWorld.UiUtils.showToast with error type', () => {
|
||||
it('calls AniWorld.UI.showToast with error type', () => {
|
||||
manager.showError('Boom');
|
||||
expect(global.AniWorld.UiUtils.showToast).toHaveBeenCalledWith(
|
||||
expect(global.AniWorld.UI.showToast).toHaveBeenCalledWith(
|
||||
'Boom', 'error'
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user