Config state temp2
This commit is contained in:
60
src/tests/stores/configStateTests.ts
Normal file
60
src/tests/stores/configStateTests.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { get } from "svelte/store";
|
||||
import configState, { Config2 } from "$lib/stores/configState"
|
||||
import { expect } from 'vitest';
|
||||
import UnitTest from "../UnitTest";
|
||||
import { Watch } from "@litegraph-ts/nodes-basic";
|
||||
|
||||
export default class configStateTests extends UnitTest {
|
||||
test__parse__parsesBasic() {
|
||||
const testConf = {
|
||||
backend: {
|
||||
comfyUIHostname: 'test',
|
||||
comfyUIPort: 8187,
|
||||
},
|
||||
behavior: {
|
||||
alwaysStripUserState: false,
|
||||
},
|
||||
};
|
||||
|
||||
expect(Config2.safeParse(testConf).success).toEqual(true);
|
||||
}
|
||||
|
||||
test__parse__parsesFallbacks() {
|
||||
const testConf = {
|
||||
backend: {},
|
||||
behavior: {}
|
||||
};
|
||||
|
||||
const result = Config2.safeParse(testConf)
|
||||
|
||||
console.warn(result)
|
||||
expect(result.success).toEqual(true);
|
||||
expect(result.data).toEqual({
|
||||
backend: {
|
||||
comfyUIHostname: "localhost",
|
||||
comfyUIPort: 8188
|
||||
},
|
||||
behavior: {
|
||||
alwaysStripUserState: false
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
test__parse__parsesFallbacks2() {
|
||||
const testConf = "foo";
|
||||
|
||||
const result = Config2.safeParse(testConf)
|
||||
|
||||
console.warn(result)
|
||||
expect(result.success).toEqual(true);
|
||||
expect(result.data).toEqual({
|
||||
backend: {
|
||||
comfyUIHostname: "localhost",
|
||||
comfyUIPort: 8188
|
||||
},
|
||||
behavior: {
|
||||
alwaysStripUserState: false
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -3,3 +3,4 @@ export { default as ComfyGraphTests } from "./ComfyGraphTests"
|
||||
export { default as parseA1111Tests } from "./parseA1111Tests"
|
||||
export { default as convertA1111ToStdPromptTests } from "./convertA1111ToStdPromptTests"
|
||||
export { default as convertVanillaWorkflowTest } from "./convertVanillaWorkflowTests"
|
||||
export { default as configStateTests } from "./stores/configStateTests"
|
||||
|
||||
Reference in New Issue
Block a user