@object-ui/plugin-list 3.1.1 → 3.1.3

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.
@@ -40,7 +40,7 @@ describe('ListView Data Fetch', () => {
40
40
  it('shows data limit warning when items reach the page size', async () => {
41
41
  // Generate exactly 100 items (default page size)
42
42
  const items = Array.from({ length: 100 }, (_, i) => ({
43
- _id: String(i),
43
+ id: String(i),
44
44
  name: `Item ${i}`,
45
45
  }));
46
46
  mockDataSource.find.mockResolvedValue(items);
@@ -62,8 +62,8 @@ describe('ListView Data Fetch', () => {
62
62
 
63
63
  it('does not show data limit warning when items are below page size', async () => {
64
64
  const items = [
65
- { _id: '1', name: 'Alice' },
66
- { _id: '2', name: 'Bob' },
65
+ { id: '1', name: 'Alice' },
66
+ { id: '2', name: 'Bob' },
67
67
  ];
68
68
  mockDataSource.find.mockResolvedValue(items);
69
69
 
@@ -84,7 +84,7 @@ describe('ListView Data Fetch', () => {
84
84
 
85
85
  it('uses custom page size from schema.pagination', async () => {
86
86
  const items = Array.from({ length: 50 }, (_, i) => ({
87
- _id: String(i),
87
+ id: String(i),
88
88
  name: `Item ${i}`,
89
89
  }));
90
90
  mockDataSource.find.mockResolvedValue(items);
@@ -126,7 +126,7 @@ describe('ListView Data Fetch', () => {
126
126
  },
127
127
  });
128
128
  mockDataSource.find.mockResolvedValue([
129
- { _id: '1', name: 'Order 1', customer: { name: 'Alice' }, account: { name: 'Acme' } },
129
+ { id: '1', name: 'Order 1', customer: { name: 'Alice' }, account: { name: 'Acme' } },
130
130
  ]);
131
131
 
132
132
  const schema: ListViewSchema = {
@@ -152,7 +152,7 @@ describe('ListView Data Fetch', () => {
152
152
  let resolveSchema: (value: any) => void;
153
153
  const schemaPromise = new Promise(resolve => { resolveSchema = resolve; });
154
154
  mockDataSource.getObjectSchema = vi.fn().mockReturnValue(schemaPromise);
155
- mockDataSource.find.mockResolvedValue([{ _id: '1', name: 'Item 1' }]);
155
+ mockDataSource.find.mockResolvedValue([{ id: '1', name: 'Item 1' }]);
156
156
 
157
157
  const schema: ListViewSchema = {
158
158
  type: 'list-view',
@@ -203,14 +203,14 @@ describe('ListView Data Fetch', () => {
203
203
  );
204
204
 
205
205
  // Resolve second (newer) request first
206
- resolveSecond!([{ _id: '2', name: 'Second' }]);
206
+ resolveSecond!([{ id: '2', name: 'Second' }]);
207
207
 
208
208
  await vi.waitFor(() => {
209
209
  expect(mockDataSource.find).toHaveBeenCalled();
210
210
  });
211
211
 
212
212
  // Resolve first (stale) request later
213
- resolveFirst!([{ _id: '1', name: 'First (stale)' }]);
213
+ resolveFirst!([{ id: '1', name: 'First (stale)' }]);
214
214
 
215
215
  // Wait for state to settle — second request data should win
216
216
  await vi.waitFor(() => {
@@ -76,8 +76,8 @@ describe('ListView Export', () => {
76
76
 
77
77
  it('should handle export with complex object fields in CSV safely', async () => {
78
78
  const mockItems = [
79
- { _id: '1', name: 'Alice', tags: ['admin', 'user'], metadata: { role: 'lead' } },
80
- { _id: '2', name: 'Bob', tags: ['user'], metadata: null },
79
+ { id: '1', name: 'Alice', tags: ['admin', 'user'], metadata: { role: 'lead' } },
80
+ { id: '2', name: 'Bob', tags: ['user'], metadata: null },
81
81
  ];
82
82
  mockDataSource.find.mockResolvedValue(mockItems);
83
83
 
@@ -134,7 +134,7 @@ describe('ListView Export', () => {
134
134
 
135
135
  it('should handle export with JSON format', async () => {
136
136
  const mockItems = [
137
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
137
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
138
138
  ];
139
139
  mockDataSource.find.mockResolvedValue(mockItems);
140
140
 
@@ -430,9 +430,9 @@ describe('ListView', () => {
430
430
 
431
431
  it('should show record count bar when data is loaded', async () => {
432
432
  const mockItems = [
433
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
434
- { _id: '2', name: 'Bob', email: 'bob@test.com' },
435
- { _id: '3', name: 'Charlie', email: 'charlie@test.com' },
433
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
434
+ { id: '2', name: 'Bob', email: 'bob@test.com' },
435
+ { id: '3', name: 'Charlie', email: 'charlie@test.com' },
436
436
  ];
437
437
  mockDataSource.find.mockResolvedValue(mockItems);
438
438
 
@@ -930,8 +930,8 @@ describe('ListView', () => {
930
930
  describe('showRecordCount flag', () => {
931
931
  it('should hide record count bar when showRecordCount is false', async () => {
932
932
  const mockItems = [
933
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
934
- { _id: '2', name: 'Bob', email: 'bob@test.com' },
933
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
934
+ { id: '2', name: 'Bob', email: 'bob@test.com' },
935
935
  ];
936
936
  mockDataSource.find.mockResolvedValue(mockItems);
937
937
 
@@ -957,7 +957,7 @@ describe('ListView', () => {
957
957
 
958
958
  it('should show record count bar by default (showRecordCount undefined)', async () => {
959
959
  const mockItems = [
960
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
960
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
961
961
  ];
962
962
  mockDataSource.find.mockResolvedValue(mockItems);
963
963
 
@@ -1453,7 +1453,7 @@ describe('ListView', () => {
1453
1453
  describe('pageSizeOptions', () => {
1454
1454
  it('should render page size selector when pageSizeOptions is provided', async () => {
1455
1455
  const mockItems = [
1456
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
1456
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
1457
1457
  ];
1458
1458
  mockDataSource.find.mockResolvedValue(mockItems);
1459
1459
 
@@ -1474,7 +1474,7 @@ describe('ListView', () => {
1474
1474
 
1475
1475
  it('should not render page size selector when pageSizeOptions is not provided', async () => {
1476
1476
  const mockItems = [
1477
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
1477
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
1478
1478
  ];
1479
1479
  mockDataSource.find.mockResolvedValue(mockItems);
1480
1480
 
@@ -1539,8 +1539,8 @@ describe('ListView', () => {
1539
1539
  data: {
1540
1540
  provider: 'value',
1541
1541
  items: [
1542
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
1543
- { _id: '2', name: 'Bob', email: 'bob@test.com' },
1542
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
1543
+ { id: '2', name: 'Bob', email: 'bob@test.com' },
1544
1544
  ],
1545
1545
  } as any,
1546
1546
  };
@@ -1562,8 +1562,8 @@ describe('ListView', () => {
1562
1562
  viewType: 'grid',
1563
1563
  fields: ['name', 'email'],
1564
1564
  data: [
1565
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
1566
- { _id: '2', name: 'Bob', email: 'bob@test.com' },
1565
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
1566
+ { id: '2', name: 'Bob', email: 'bob@test.com' },
1567
1567
  ] as any,
1568
1568
  };
1569
1569
 
@@ -1584,9 +1584,9 @@ describe('ListView', () => {
1584
1584
  viewType: 'grid',
1585
1585
  fields: ['name', 'email'],
1586
1586
  data: [
1587
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
1588
- { _id: '2', name: 'Bob', email: 'bob@test.com' },
1589
- { _id: '3', name: 'Charlie', email: 'charlie@test.com' },
1587
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
1588
+ { id: '2', name: 'Bob', email: 'bob@test.com' },
1589
+ { id: '3', name: 'Charlie', email: 'charlie@test.com' },
1590
1590
  ] as any,
1591
1591
  };
1592
1592
 
@@ -1616,8 +1616,8 @@ describe('ListView', () => {
1616
1616
  data: {
1617
1617
  provider: 'value',
1618
1618
  items: [
1619
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
1620
- { _id: '2', name: 'Bob', email: 'bob@test.com' },
1619
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
1620
+ { id: '2', name: 'Bob', email: 'bob@test.com' },
1621
1621
  ],
1622
1622
  } as any,
1623
1623
  };
@@ -1641,7 +1641,7 @@ describe('ListView', () => {
1641
1641
 
1642
1642
  it('should fall back to dataSource.find when schema.data is not set', async () => {
1643
1643
  const mockItems = [
1644
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
1644
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
1645
1645
  ];
1646
1646
  mockDataSource.find.mockResolvedValue(mockItems);
1647
1647
 
@@ -1947,8 +1947,8 @@ describe('ListView', () => {
1947
1947
  describe('pageSizeOptions dynamic integration', () => {
1948
1948
  it('should render page size selector as controlled component', async () => {
1949
1949
  const mockItems = [
1950
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
1951
- { _id: '2', name: 'Bob', email: 'bob@test.com' },
1950
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
1951
+ { id: '2', name: 'Bob', email: 'bob@test.com' },
1952
1952
  ];
1953
1953
  mockDataSource.find.mockResolvedValue(mockItems);
1954
1954
 
@@ -1972,8 +1972,8 @@ describe('ListView', () => {
1972
1972
 
1973
1973
  it('should re-fetch data when page size changes', async () => {
1974
1974
  const mockItems = [
1975
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
1976
- { _id: '2', name: 'Bob', email: 'bob@test.com' },
1975
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
1976
+ { id: '2', name: 'Bob', email: 'bob@test.com' },
1977
1977
  ];
1978
1978
  mockDataSource.find.mockResolvedValue(mockItems);
1979
1979
 
@@ -2008,7 +2008,7 @@ describe('ListView', () => {
2008
2008
 
2009
2009
  it('should render all page size options in the selector', async () => {
2010
2010
  const mockItems = [
2011
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
2011
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
2012
2012
  ];
2013
2013
  mockDataSource.find.mockResolvedValue(mockItems);
2014
2014
 
@@ -2036,7 +2036,7 @@ describe('ListView', () => {
2036
2036
 
2037
2037
  it('should not render page size selector when pageSizeOptions is not configured', async () => {
2038
2038
  const mockItems = [
2039
- { _id: '1', name: 'Alice', email: 'alice@test.com' },
2039
+ { id: '1', name: 'Alice', email: 'alice@test.com' },
2040
2040
  ];
2041
2041
  mockDataSource.find.mockResolvedValue(mockItems);
2042
2042
 
@@ -1,8 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { ListView } from './index';
3
-
4
- describe('Plugin List Registration', () => {
5
- it('exports ListView component', () => {
6
- expect(ListView).toBeDefined();
7
- });
8
- });