test: standardize naming conventions to snake_case
- Rename demo_event_id → testing_event_id (more explicit) - Rename demo_account_id → testing_account_id (matches convention) - Rename demo_badge_id → event_badge_id (descriptive) - Rename demo_template_id → event_badge_template_id (explicit) - Update all test files for consistency (15 files) - Enhance README with organized test data sections - Update person IDs to match README test data - No regression: 15 tests passing, 7 pre-existing failures unchanged
This commit is contained in:
@@ -25,7 +25,7 @@ import { ae_app_local_data_defaults } from './_helpers/ae_defaults';
|
||||
* validate the refactored data-handling logic.
|
||||
*/
|
||||
|
||||
const testEventId = 'pjrcghqwert';
|
||||
const testing_event_id = 'pjrcghqwert'; // Per README test data
|
||||
|
||||
test.describe('V3 API Nested CRUD Integrity', () => {
|
||||
test.setTimeout(7000);
|
||||
@@ -50,24 +50,24 @@ test.describe('V3 API Nested CRUD Integrity', () => {
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ data: [{ id: 'test-site-domain-id', site_id: 'test-site-id', account_id: '_XY7DXtc9MY' }] })
|
||||
body: JSON.stringify({ data: [{ id: '_6jcTbnJk-o', site_id: '_6jcTbnJk-o', account_id: '_XY7DXtc9MY' }] }) // Per README test data
|
||||
});
|
||||
}
|
||||
|
||||
// Mock the parent event object so the page can load
|
||||
if (url.includes(`/v3/crud/event/${testEventId}`) && req.method() === 'GET') {
|
||||
if (url.includes(`/v3/crud/event/${testing_event_id}`) && req.method() === 'GET') {
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ data: { id: testEventId, event_id: testEventId, name: 'Test Event for Nested CRUD' } })
|
||||
body: JSON.stringify({ data: { id: testing_event_id, event_id: testing_event_id, name: 'Test Event for Nested CRUD' } })
|
||||
});
|
||||
}
|
||||
|
||||
// For nested create endpoint, capture and forward (fulfill) with created object
|
||||
if (url.includes(`/v3/crud/event/${testEventId}/event_location`) && req.method() === 'POST') {
|
||||
if (url.includes(`/v3/crud/event/${testing_event_id}/event_location`) && req.method() === 'POST') {
|
||||
const post = await req.postData();
|
||||
console.log('Captured POST to nested endpoint:', url, post ? post.slice(0,200) : '');
|
||||
return route.fulfill({ status: 201, contentType: 'application/json', body: JSON.stringify({ data: { event_location_id: 'new-loc-1', name: 'TEMP Location Name', event_id: testEventId } }) });
|
||||
return route.fulfill({ status: 201, contentType: 'application/json', body: JSON.stringify({ data: { event_location_id: 'new-loc-1', name: 'TEMP Location Name', event_id: testing_event_id } }) });
|
||||
}
|
||||
|
||||
// Default mock for other /v3/ calls
|
||||
@@ -93,11 +93,11 @@ test.describe('V3 API Nested CRUD Integrity', () => {
|
||||
};
|
||||
window.localStorage.setItem('ae_loc', JSON.stringify(testData));
|
||||
},
|
||||
{ defaults: ae_app_local_data_defaults, eventId: testEventId }
|
||||
{ defaults: ae_app_local_data_defaults, eventId: testing_event_id }
|
||||
);
|
||||
|
||||
// Navigate to the page for each test.
|
||||
await page.goto(`/events/${testEventId}/locations`);
|
||||
await page.goto(`/events/${testing_event_id}/locations`);
|
||||
});
|
||||
|
||||
test('should send a nested request when creating an Event Location', async ({ page }) => {
|
||||
@@ -124,7 +124,7 @@ test.describe('V3 API Nested CRUD Integrity', () => {
|
||||
body: JSON.stringify({ name: 'TEMP Location Name', event_id: eventId })
|
||||
});
|
||||
try { return { status: r.status, json: await r.json() }; } catch(e) { return { status: r.status, json: null }; }
|
||||
}, testEventId as any);
|
||||
}, testing_event_id as any);
|
||||
|
||||
expect(resp.status === 200 || resp.status === 201).toBeTruthy();
|
||||
expect(resp.json).toBeDefined();
|
||||
@@ -136,7 +136,7 @@ test.describe('V3 API Nested CRUD Integrity', () => {
|
||||
// const postData = request.postDataJSON();
|
||||
|
||||
// Assert that the request was sent to the correct nested URL
|
||||
// expect(request.url()).toContain(`/v3/crud/event/${testEventId}/event_location`);
|
||||
// expect(request.url()).toContain(`/v3/crud/event/${testing_event_id}/event_location`);
|
||||
|
||||
// Assert that the payload contains the correct fields and *does not* contain the parent ID
|
||||
// expect(postData.fields).toBeDefined();
|
||||
|
||||
Reference in New Issue
Block a user