Files
ComfyUI_frontend/tests-ui/tests/maskeditor.test.ts
brucew4yn3rp 83aa887456 [Feature] Enhanced MaskEditor to an Image Canvas (#4361)
Co-authored-by: duckcomfy <a@a.a>
2025-07-24 16:23:50 +10:00

20 lines
986 B
TypeScript

import { describe, expect, it } from 'vitest'
import { imageLayerFilenamesIfApplicable } from '@/extensions/core/maskEditorLayerFilenames'
describe('imageLayerFilenamesIfApplicable', () => {
// In case the naming scheme changes, this test will ensure CI fails if developers forget to support the old naming scheme. (Causing MaskEditor to lose layer data for previously-saved images.)
it('should support all past layer naming schemes to preserve backward compatibility', async () => {
const dummyTimestamp = 1234567890
const inputToSupport = `clipspace-painted-masked-${dummyTimestamp}.png`
const expectedOutput = {
maskedImage: `clipspace-mask-${dummyTimestamp}.png`,
paint: `clipspace-paint-${dummyTimestamp}.png`,
paintedImage: `clipspace-painted-${dummyTimestamp}.png`,
paintedMaskedImage: inputToSupport
}
const actualOutput = imageLayerFilenamesIfApplicable(inputToSupport)
expect(actualOutput).toEqual(expectedOutput)
})
})