mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-08-02 12:32:14 +00:00
test: fix
This commit is contained in:
parent
76a1cbbeac
commit
9742e180fa
3 changed files with 10 additions and 7 deletions
|
|
@ -11,6 +11,7 @@ import { By } from '@angular/platform-browser';
|
|||
|
||||
import { DialogImportFromUrlComponent } from './dialog-import-from-url.component';
|
||||
import { T } from '../../t.const';
|
||||
import { Log } from '../../core/log';
|
||||
|
||||
describe('DialogImportFromUrlComponent', () => {
|
||||
let component: DialogImportFromUrlComponent;
|
||||
|
|
@ -161,12 +162,12 @@ describe('DialogImportFromUrlComponent', () => {
|
|||
});
|
||||
|
||||
it('should log error when URL is empty', () => {
|
||||
spyOn(console, 'error');
|
||||
spyOn(Log, 'err');
|
||||
component.url = '';
|
||||
|
||||
component.submit();
|
||||
|
||||
expect(console.error).toHaveBeenCalledWith('', 'URL is required.');
|
||||
expect(Log.err).toHaveBeenCalledWith('URL is required.');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import { PluginShortcutCfg } from '../../plugins/plugin-api.model';
|
|||
import { ThemeSelectorComponent } from '../../core/theme/theme-selector/theme-selector.component';
|
||||
import { Log } from '../../core/log';
|
||||
import { downloadLogs } from '../../util/download';
|
||||
import { SnackService } from '../../core/snack/snack.service';
|
||||
|
||||
@Component({
|
||||
selector: 'config-page',
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { createAppDataCompleteMock } from '../../util/app-data-mock';
|
|||
import { createValidate } from 'typia';
|
||||
import { initialTaskState } from '../../features/tasks/store/task.reducer';
|
||||
import { DEFAULT_TASK, TaskState } from '../../features/tasks/task.model';
|
||||
import { PFLog } from '../../core/log';
|
||||
|
||||
interface TestInterface {
|
||||
globalConfig: {
|
||||
|
|
@ -20,16 +21,16 @@ interface TestInterface {
|
|||
describe('autoFixTypiaErrors', () => {
|
||||
const validate = createValidate<TestInterface>();
|
||||
|
||||
let warnSpy: jasmine.Spy;
|
||||
let errSpy: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
// Spy on console.warn to prevent test output cluttering
|
||||
warnSpy = spyOn(console, 'warn').and.stub();
|
||||
// Spy on PFLog.err to prevent test output cluttering
|
||||
errSpy = spyOn(PFLog, 'err').and.stub();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Reset spies
|
||||
warnSpy.calls.reset();
|
||||
errSpy.calls.reset();
|
||||
});
|
||||
|
||||
it('should return data unchanged when no errors', () => {
|
||||
|
|
@ -173,7 +174,7 @@ describe('autoFixTypiaErrors', () => {
|
|||
'2025-06-16'
|
||||
],
|
||||
).toBe(0);
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
expect(errSpy).toHaveBeenCalledWith(
|
||||
"Fixed: simpleCounter.entities['BpYFLFtlIGGgTNfZB-t2-'].countOnDay['2025-06-16'] from null to 0 for simpleCounter",
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue