Skip to content

Commit 21daee1

Browse files
authored
test(spec): Phase 3 diff and query conformance test suites (#792)
Add 22 portable conformance test fixtures and two Rust test modules under the Phase 2 fixture-discovery pattern. Diff conformance (12 fixtures, conformance/diff/): identical-tokens, simple-add-delete, rename-by-uuid, deprecated-new-token, deprecated-set-level, reverted-token, matched-gaining-deprecated, property-value-update, property-nested-change, uuid-backfill, cross-format, rename-with-property-changes Query conformance (10 fixtures, conformance/query/): single-field, and-conditions, or-conditions, negation, wildcard-suffix, wildcard-prefix, empty-matches-all, no-matches, schema-key, and-or-precedence Test modules diff_conformance and query_conformance added to sdk/core/src/lib.rs. All 118 tests pass. Closes #788
1 parent a6f2435 commit 21daee1

68 files changed

Lines changed: 856 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/design-data-spec/conformance/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,55 @@ Each **resolution** case lives under `resolution/<name>/` with:
3737
| `resolution/alias-resolved-after-cascade` | Cascade selects the winner first; alias `$ref` chain resolves after. |
3838

3939
The Rust SDK drives these fixtures in `sdk/core/src/lib.rs` (`resolution_conformance` module, closes [#768](https://github.com/adobe/spectrum-design-data/issues/768)).
40+
41+
***
42+
43+
## Diff conformance fixtures
44+
45+
Each **diff** case lives under `diff/<name>/` with:
46+
47+
* `old/` — old token dataset (`.tokens.json` cascade arrays or `.json` legacy format)
48+
* `new/` — new token dataset
49+
* `expected.json` — full `DiffReport` structure (six category arrays: renamed, deprecated, reverted, added, deleted, updated)
50+
51+
| Folder | Intent |
52+
| ------------------------------------- | -------------------------------------------------------------------------------- |
53+
| `diff/identical-tokens` | Two identical datasets MUST produce an empty diff (all arrays empty). |
54+
| `diff/simple-add-delete` | One old-only token → deleted; one new-only token → added. |
55+
| `diff/rename-by-uuid` | Same UUID, different name objects → renamed (not add + delete). |
56+
| `diff/deprecated-new-token` | Unmatched new token with `deprecated: true` → deprecated (not added). |
57+
| `diff/deprecated-set-level` | All set entries `deprecated: true` normalizes to token-level deprecated. |
58+
| `diff/reverted-token` | Matched token that loses `deprecated` → reverted (not updated). |
59+
| `diff/matched-gaining-deprecated` | Matched token that gains `deprecated` → updated (not deprecated). |
60+
| `diff/property-value-update` | Matched token with changed `value` → updated with property change. |
61+
| `diff/property-nested-change` | Nested object change reported at leaf path (e.g. `sets.light.value`). |
62+
| `diff/uuid-backfill` | Old lacks UUID, new gains it with same name object → paired (not add + delete). |
63+
| `diff/cross-format` | Legacy old + cascade new, paired by UUID across formats. |
64+
| `diff/rename-with-property-changes` | Renamed token with additional value changes populates `property_changes`. |
65+
66+
The Rust SDK drives these fixtures in `sdk/core/src/lib.rs` (`diff_conformance` module, closes [#788](https://github.com/adobe/spectrum-design-data/issues/788)).
67+
68+
***
69+
70+
## Query conformance fixtures
71+
72+
Each **query** case lives under `query/<name>/` with:
73+
74+
* `input/` — cascade-format `.tokens.json` files
75+
* `query.txt` — plain-text filter expression
76+
* `expected.json` — sorted array of matched token UUIDs
77+
78+
| Folder | Intent |
79+
| ----------------------------- | ------------------------------------------------------------------------- |
80+
| `query/single-field` | Basic `key=value` equality filter. |
81+
| `query/and-conditions` | `,` (AND) requires all conditions to match. |
82+
| `query/or-conditions` | `\|` (OR) matches if any alternative matches. |
83+
| `query/negation` | `!=` matches non-equal values and absent fields. |
84+
| `query/wildcard-suffix` | Glob `*` at end of value matches prefix. |
85+
| `query/wildcard-prefix` | Glob `*` at start of value matches suffix. |
86+
| `query/empty-matches-all` | Empty filter expression is a universal match. |
87+
| `query/no-matches` | Filter with no matching tokens returns empty result. |
88+
| `query/schema-key` | `$schema` key queries the top-level `$schema` field. |
89+
| `query/and-or-precedence` | AND binds tighter than OR: `a,b\|c` = `(a AND b) OR c`. |
90+
91+
The Rust SDK drives these fixtures in `sdk/core/src/lib.rs` (`query_conformance` module, closes [#788](https://github.com/adobe/spectrum-design-data/issues/788)).
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"renamed": [
3+
{
4+
"old_name": "background-color-default",
5+
"new_name": "background-color-default",
6+
"uuid": "aaaaaaaa-0001-4000-8000-000000000001",
7+
"property_changes": [
8+
{
9+
"path": "name",
10+
"change_type": "added",
11+
"new_value": { "property": "background-color-default" }
12+
},
13+
{
14+
"path": "value",
15+
"change_type": "updated",
16+
"new_value": "#000000",
17+
"original_value": "#ffffff"
18+
}
19+
]
20+
}
21+
],
22+
"deprecated": [],
23+
"reverted": [],
24+
"added": [],
25+
"deleted": [],
26+
"updated": []
27+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"name": { "property": "background-color-default" },
4+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
5+
"value": "#000000",
6+
"uuid": "aaaaaaaa-0001-4000-8000-000000000001"
7+
}
8+
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"background-color-default": {
3+
"$schema": "https://opensource.adobe.com/spectrum-design-data/schemas/token-types/color.json",
4+
"value": "#ffffff",
5+
"uuid": "aaaaaaaa-0001-4000-8000-000000000001"
6+
}
7+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"renamed": [],
3+
"deprecated": [
4+
{
5+
"name": "deprecated-token",
6+
"uuid": "aaaaaaaa-0001-4000-8000-000000000001"
7+
}
8+
],
9+
"reverted": [],
10+
"added": [],
11+
"deleted": [],
12+
"updated": []
13+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"name": { "property": "deprecated-token" },
4+
"deprecated": true,
5+
"value": "#999999",
6+
"uuid": "aaaaaaaa-0001-4000-8000-000000000001"
7+
}
8+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"renamed": [],
3+
"deprecated": [
4+
{
5+
"name": "set-deprecated-token",
6+
"uuid": "aaaaaaaa-0001-4000-8000-000000000001"
7+
}
8+
],
9+
"reverted": [],
10+
"added": [],
11+
"deleted": [],
12+
"updated": []
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"name": { "property": "set-deprecated-token" },
4+
"uuid": "aaaaaaaa-0001-4000-8000-000000000001",
5+
"sets": {
6+
"light": { "value": "#ffffff", "deprecated": true },
7+
"dark": { "value": "#000000", "deprecated": true }
8+
}
9+
}
10+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

0 commit comments

Comments
 (0)