test: move prefixed splits into domain folders
- Move newly split tests under explicit domain subfolders - Update nested helper imports after the moves - Add a lint guard against repeating existing sibling domains as filename prefixes
This commit is contained in:
parent
b9da0dcb76
commit
aad26b535e
|
|
@ -1167,6 +1167,20 @@ const noTopLevelPrefixedTestFiles = createProgramFilenameRule({
|
|||
}
|
||||
})
|
||||
|
||||
const noSiblingDomainPrefixedTestFiles = createProgramFilenameRule({
|
||||
description: 'Disallow test files that repeat an existing sibling domain folder as a filename prefix',
|
||||
check(file) {
|
||||
const match = file.match(/^(.*\/tests\/(?:engine|e2e)\/.+\/)([^/]+)-[^/]+\.(?:test|spec)\.ts$/)
|
||||
if (!match) return false
|
||||
|
||||
const [, dir, prefix] = match
|
||||
if (!existsSync(`${dir}${prefix}`)) return false
|
||||
|
||||
const filename = file.slice(dir.length)
|
||||
return `Move '${filename}' under the existing '${prefix}/' folder instead of repeating the domain as a filename prefix.`
|
||||
}
|
||||
})
|
||||
|
||||
const noFlatKiwiModules = createProgramFilenameRule({
|
||||
description: 'Disallow flat top-level Kiwi modules — group code under Kiwi subdomains',
|
||||
check(file) {
|
||||
|
|
@ -1228,7 +1242,8 @@ const plugin = {
|
|||
'no-useless-pass-through-wrappers': noUselessPassThroughWrappers,
|
||||
'no-function-alias-imports': noFunctionAliasImports,
|
||||
'no-flat-kiwi-modules': noFlatKiwiModules,
|
||||
'no-top-level-prefixed-test-files': noTopLevelPrefixedTestFiles
|
||||
'no-top-level-prefixed-test-files': noTopLevelPrefixedTestFiles,
|
||||
'no-sibling-domain-prefixed-test-files': noSiblingDomainPrefixedTestFiles
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,8 @@
|
|||
"open-pencil/non-component-source-directories-kebab-case": "error",
|
||||
"open-pencil/no-component-root-sibling-folder": "error",
|
||||
"open-pencil/no-flat-kiwi-modules": "error",
|
||||
"open-pencil/no-top-level-prefixed-test-files": "error"
|
||||
"open-pencil/no-top-level-prefixed-test-files": "error",
|
||||
"open-pencil/no-sibling-domain-prefixed-test-files": "error"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { importNodeChanges } from '@open-pencil/core'
|
|||
|
||||
import { expectDefined } from '#tests/helpers/assert'
|
||||
|
||||
import { canvas, doc, node } from './helpers'
|
||||
import { canvas, doc, node } from '../helpers'
|
||||
|
||||
describe('fig-import: arc data', () => {
|
||||
test('partial ellipse', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { importNodeChanges } from '@open-pencil/core'
|
||||
|
||||
import { canvas, doc, node } from './helpers'
|
||||
import { canvas, doc, node } from '../helpers'
|
||||
|
||||
describe('fig-import: auto-layout alignment', () => {
|
||||
test('maps SPACE_EVENLY kiwi primary alignment to Figma space-between', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { importNodeChanges } from '@open-pencil/core'
|
||||
|
||||
import { canvas, doc, node } from './helpers'
|
||||
import { canvas, doc, node } from '../helpers'
|
||||
|
||||
describe('fig-import: blend mode', () => {
|
||||
test('node blend mode', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { importNodeChanges } from '@open-pencil/core'
|
||||
|
||||
import { canvas, doc, node } from './helpers'
|
||||
import { canvas, doc, node } from '../helpers'
|
||||
|
||||
describe('fig-import: clipsContent with resizeToFit', () => {
|
||||
test('regular FRAME with frameMaskDisabled=false clips content', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { importNodeChanges } from '@open-pencil/core'
|
||||
|
||||
import { canvas, doc, node } from './helpers'
|
||||
import { canvas, doc, node } from '../helpers'
|
||||
|
||||
describe('fig-import: component set detection', () => {
|
||||
test('FRAME with VARIANT componentPropDefs becomes COMPONENT_SET', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { importNodeChanges } from '@open-pencil/core'
|
||||
|
||||
import { canvas, doc, node } from './helpers'
|
||||
import { canvas, doc, node } from '../helpers'
|
||||
|
||||
describe('fig-import: image fills', () => {
|
||||
test('image fill with hash', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { importNodeChanges } from '@open-pencil/core'
|
||||
|
||||
import { canvas, doc, node } from './helpers'
|
||||
import { canvas, doc, node } from '../helpers'
|
||||
|
||||
describe('fig-import: independent stroke weights', () => {
|
||||
test('border weights imported', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { importNodeChanges } from '@open-pencil/core'
|
||||
|
||||
import { canvas, doc, node } from './helpers'
|
||||
import { canvas, doc, node } from '../helpers'
|
||||
|
||||
describe('fig-import: multiple fills', () => {
|
||||
test('solid + gradient stacked', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { importNodeChanges } from '@open-pencil/core'
|
||||
|
||||
import { canvas, doc, node } from './helpers'
|
||||
import { canvas, doc, node } from '../helpers'
|
||||
|
||||
describe('fig-import: node types', () => {
|
||||
test('ROUNDED_RECTANGLE imported as its own type', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('absolute position', () => {
|
||||
test('absoluteBoundingBox accounts for nesting', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('auto-layout', () => {
|
||||
test('layoutMode', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('auto-layout extras', () => {
|
||||
test('primaryAxisSizingMode maps FIXED/AUTO', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('corner radius', () => {
|
||||
test('uniform corner radius', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('createComponentFromNode', () => {
|
||||
test('converts frame to component', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { expectDefined } from '#tests/helpers/assert'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('document & pages', () => {
|
||||
test('root has pages as children', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('findAllWithCriteria', () => {
|
||||
test('filters by type', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { type Fill } from '@open-pencil/core'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('frozen arrays', () => {
|
||||
test('fills returns frozen clone', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('internals not exposed', () => {
|
||||
test('node has no _id, _graph, _api properties', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { getNodeOrThrow } from '#tests/helpers/assert'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('layout sizing', () => {
|
||||
test('child in horizontal parent: h=primary, v=counter', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('min/max dimensions', () => {
|
||||
test('defaults to null', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { expectDefined } from '#tests/helpers/assert'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('node creation', () => {
|
||||
test('createFrame', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('property access', () => {
|
||||
test('name get/set', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('stroke details', () => {
|
||||
test('strokeWeight and strokeAlign', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('text', () => {
|
||||
test('characters maps to text content', () => {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, expect, test } from 'bun:test'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('text extras', () => {
|
||||
test('textTruncation', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { expectDefined } from '#tests/helpers/assert'
|
||||
|
||||
import { createAPI } from './helpers'
|
||||
import { createAPI } from '../helpers'
|
||||
|
||||
describe('tree operations', () => {
|
||||
test('appendChild reparents', () => {
|
||||
|
|
@ -4,7 +4,7 @@ import { SceneGraph, sceneNodeToKiwi } from '@open-pencil/core'
|
|||
|
||||
import { expectDefined, getNodeOrThrow } from '#tests/helpers/assert'
|
||||
|
||||
import { ROOT_GUID, pageId } from './helpers'
|
||||
import { ROOT_GUID, pageId } from '../helpers'
|
||||
|
||||
describe('Fix 1: auto-layout child transforms', () => {
|
||||
test('auto-layout child gets zero transform regardless of its x/y', () => {
|
||||
|
|
@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
|
|||
|
||||
import { SceneGraph } from '@open-pencil/core'
|
||||
|
||||
import { pageId, toKiwi } from './helpers'
|
||||
import { pageId, toKiwi } from '../helpers'
|
||||
|
||||
describe('Fix 3: bordersTakeSpace serialization', () => {
|
||||
test('auto-layout frame with strokesIncludedInLayout=true gets bordersTakeSpace=true', () => {
|
||||
|
|
@ -4,7 +4,7 @@ import { exportFigFile, parseFigFile, SceneGraph } from '@open-pencil/core'
|
|||
|
||||
import { expectDefined } from '#tests/helpers/assert'
|
||||
|
||||
import { pageId, toKiwi } from './helpers'
|
||||
import { pageId, toKiwi } from '../helpers'
|
||||
|
||||
describe('Fix 5: font family normalization in derivedTextData', () => {
|
||||
test('optical size suffix stripped in roundtrip', async () => {
|
||||
|
|
@ -4,7 +4,7 @@ import { exportFigFile, parseFigFile, SceneGraph } from '@open-pencil/core'
|
|||
|
||||
import { expectDefined } from '#tests/helpers/assert'
|
||||
|
||||
import { pageId, toKiwi } from './helpers'
|
||||
import { pageId, toKiwi } from '../helpers'
|
||||
|
||||
describe('Fix 2: frameMaskDisabled is inverse of clipsContent', () => {
|
||||
test('FRAME without clipsContent gets frameMaskDisabled=true', () => {
|
||||
|
|
@ -4,7 +4,7 @@ import { exportFigFile, parseFigFile, SceneGraph } from '@open-pencil/core'
|
|||
|
||||
import { expectDefined } from '#tests/helpers/assert'
|
||||
|
||||
import { pageId, toKiwi } from './helpers'
|
||||
import { pageId, toKiwi } from '../helpers'
|
||||
|
||||
describe('Fix 4: text lineHeight serialization', () => {
|
||||
test('text node with explicit lineHeight uses that value', () => {
|
||||
Loading…
Reference in a new issue