mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-11 16:24:11 +01:00
* Tests: convert all common tests from mocha to karma * Tests: refactor Vuetify setup in tests * Tests: update package-lock.json * Tests: convert all model test to vitest 1/2 * Tests: convert all model test to vitest 2/2 * Tests: fix broken test * Tests: time zone UTC * Tests: Add playwright screenshots folder to gitignore * Tests: Add timezone to vitest scripts * Tests: Add Vitest scripts to Makefile * Tests: delete unused timezone configs * Tests: Update some tests * Tests: Update vitest config * Tests: Delete usesless try-catch
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import { describe, it, expect } from 'vitest';
|
|
import "../fixtures";
|
|
import ConfigOptions from "model/config-options";
|
|
|
|
describe("model/config-options", () => {
|
|
it("should get options defaults", () => {
|
|
const values = {};
|
|
const options = new ConfigOptions(values);
|
|
const result = options.getDefaults();
|
|
expect(result.Debug).toBe(false);
|
|
expect(result.ReadOnly).toBe(false);
|
|
expect(result.ThumbSize).toBe(0);
|
|
});
|
|
|
|
it("should test changed", () => {
|
|
const values = {};
|
|
const options = new ConfigOptions(values);
|
|
expect(options.changed()).toBe(false);
|
|
});
|
|
|
|
it("should load options", async () => {
|
|
const values = {};
|
|
const options = new ConfigOptions(values);
|
|
try {
|
|
const response = await options.load();
|
|
expect(response.success).toBe("ok");
|
|
} catch (error) {
|
|
// Vitest will fail the test if a promise rejects
|
|
throw error;
|
|
}
|
|
expect(options.changed()).toBe(false);
|
|
});
|
|
|
|
it("should save options", async () => {
|
|
const values = { Debug: true };
|
|
const options = new ConfigOptions(values);
|
|
try {
|
|
const response = await options.save();
|
|
expect(response.success).toBe("ok");
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
expect(options.changed()).toBe(false);
|
|
});
|
|
}); |