pte-interpolation-core 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pte-interpolation-core",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Framework-agnostic utilities for Portable Text variable interpolation",
@@ -22,14 +22,14 @@ describe('getMissingVariableKeys', () => {
22
22
  })
23
23
 
24
24
  it('returns empty array when all variables provided', () => {
25
- expect(getMissingVariableKeys(singleVariableBlock, {firstName: 'Alice'})).toEqual([])
25
+ expect(getMissingVariableKeys(singleVariableBlock, {firstName: 'Patrick'})).toEqual([])
26
26
  })
27
27
 
28
28
  it('returns empty array when all multiple variables provided', () => {
29
29
  expect(
30
30
  getMissingVariableKeys(multipleVariablesBlock, {
31
- firstName: 'Alice',
32
- lastName: 'Smith',
31
+ firstName: 'Patrick',
32
+ lastName: 'Pickles',
33
33
  email: 'a@b.com',
34
34
  }),
35
35
  ).toEqual([])
@@ -40,7 +40,7 @@ describe('getMissingVariableKeys', () => {
40
40
  })
41
41
 
42
42
  it('returns only missing keys when some values provided', () => {
43
- expect(getMissingVariableKeys(multipleVariablesBlock, {firstName: 'Alice'})).toEqual([
43
+ expect(getMissingVariableKeys(multipleVariablesBlock, {firstName: 'Patrick'})).toEqual([
44
44
  'lastName',
45
45
  'email',
46
46
  ])
@@ -51,7 +51,7 @@ describe('getMissingVariableKeys', () => {
51
51
  })
52
52
 
53
53
  it('returns missing keys across multiple blocks', () => {
54
- expect(getMissingVariableKeys(multiBlockContent, {firstName: 'Alice'})).toEqual(['email'])
54
+ expect(getMissingVariableKeys(multiBlockContent, {firstName: 'Patrick'})).toEqual(['email'])
55
55
  })
56
56
 
57
57
  it('deduplicates missing keys', () => {
@@ -67,14 +67,14 @@ describe('getMissingVariableKeys', () => {
67
67
  })
68
68
 
69
69
  it('returns missing keys for consecutive variables', () => {
70
- expect(getMissingVariableKeys(consecutiveVariablesBlock, {firstName: 'Alice'})).toEqual([
70
+ expect(getMissingVariableKeys(consecutiveVariablesBlock, {firstName: 'Patrick'})).toEqual([
71
71
  'lastName',
72
72
  ])
73
73
  })
74
74
 
75
75
  it('ignores extra values not in blocks', () => {
76
76
  expect(
77
- getMissingVariableKeys(singleVariableBlock, {firstName: 'Alice', extraKey: 'ignored'}),
77
+ getMissingVariableKeys(singleVariableBlock, {firstName: 'Patrick', extraKey: 'ignored'}),
78
78
  ).toEqual([])
79
79
  })
80
80
 
@@ -19,7 +19,7 @@ describe('interpolateToString', () => {
19
19
  })
20
20
 
21
21
  it('resolves a single variable from values', () => {
22
- expect(interpolateToString(singleVariableBlock, {firstName: 'Alice'})).toBe('Hello, Alice!')
22
+ expect(interpolateToString(singleVariableBlock, {firstName: 'Patrick'})).toBe('Hello, Patrick!')
23
23
  })
24
24
 
25
25
  it('uses default fallback for missing variables', () => {
@@ -37,23 +37,23 @@ describe('interpolateToString', () => {
37
37
 
38
38
  it('resolves consecutive variables', () => {
39
39
  expect(
40
- interpolateToString(consecutiveVariablesBlock, {firstName: 'Alice', lastName: 'Smith'}),
41
- ).toBe('AliceSmith')
40
+ interpolateToString(consecutiveVariablesBlock, {firstName: 'Patrick', lastName: 'Pickles'}),
41
+ ).toBe('PatrickPickles')
42
42
  })
43
43
 
44
44
  it('joins multiple blocks with newlines', () => {
45
45
  expect(
46
- interpolateToString(multiBlockContent, {firstName: 'Alice', email: 'alice@example.com'}),
47
- ).toBe('Dear Alice,\nYour email is alice@example.com.')
46
+ interpolateToString(multiBlockContent, {firstName: 'Patrick', email: 'patrick@example.com'}),
47
+ ).toBe('Dear Patrick,\nYour email is patrick@example.com.')
48
48
  })
49
49
 
50
50
  it('resolves multiple variables in one block', () => {
51
51
  expect(
52
52
  interpolateToString(multipleVariablesBlock, {
53
- firstName: 'Alice',
54
- lastName: 'Smith',
55
- email: 'alice@example.com',
53
+ firstName: 'Patrick',
54
+ lastName: 'Pickles',
55
+ email: 'patrick@example.com',
56
56
  }),
57
- ).toBe('Name: Alice Smith, Email: alice@example.com')
57
+ ).toBe('Name: Patrick Pickles, Email: patrick@example.com')
58
58
  })
59
59
  })