@@ -25,53 +25,6 @@ import {
2525 getInvalidPicklistValue ,
2626} from './data/test-data-generators.js' ;
2727
28- const findNonHomeProject = async ( request , homeOrgId ) => {
29- let page = 1 ;
30- const limit = 100 ;
31-
32- while ( page <= 10 ) {
33- const response = await request
34- . get ( '/v2/project' )
35- . query ( { page, limit } )
36- . expect ( 200 ) ;
37- const data = Array . isArray ( response . body ) ? response . body : ( response . body ?. data || [ ] ) ;
38- const nonHomeProject = data . find ( record => record . orgUid && record . orgUid !== homeOrgId ) ;
39- if ( nonHomeProject ) return nonHomeProject ;
40-
41- const totalPages = response . body ?. pageCount || 1 ;
42- if ( page >= totalPages || data . length < limit ) break ;
43- page ++ ;
44- }
45-
46- return null ;
47- } ;
48-
49- const requireNonHomeProject = async ( request , homeOrgId , mochaContext ) => {
50- const nonHomeProject = await findNonHomeProject ( request , homeOrgId ) ;
51- if ( ! nonHomeProject ) {
52- mochaContext . skip ( ) ;
53- }
54- return nonHomeProject ;
55- } ;
56-
57- const buildProjectUpdateData = ( record , overrides = { } ) => ( {
58- projectRegistryName : record . projectRegistryName ,
59- projectId : record . projectId ,
60- projectName : record . projectName ,
61- projectCreditingProgram : record . projectCreditingProgram ?? null ,
62- projectLink : record . projectLink ?? null ,
63- projectDescription : record . projectDescription ?? null ,
64- projectSector : record . projectSector ?? null ,
65- projectType : record . projectType ?? null ,
66- projectSubtype : record . projectSubtype ?? null ,
67- projectStatus : record . projectStatus ?? null ,
68- projectStatusDate : record . projectStatusDate ?? null ,
69- projectUnitMetric : record . projectUnitMetric ?? null ,
70- cadTrustReferenceProjectId : record . cadTrustReferenceProjectId ?? null ,
71- cadTrustProgramId : record . cadTrustProgramId ?? null ,
72- ...overrides ,
73- } ) ;
74-
7528describe ( 'Project Live API Validation Tests' , function ( ) {
7629 this . timeout ( 600000 ) ; // 10 minute timeout
7730 let request ;
@@ -225,26 +178,6 @@ describe('Project Live API Validation Tests', function () {
225178 } ) ;
226179 } ) ;
227180 describe ( 'Step 7: PUT Request Tests' , function ( ) {
228- it ( 'should reject updating a project not owned by the home organization' , async function ( ) {
229- const nonHomeProject = await requireNonHomeProject ( request , homeOrgId , this ) ;
230-
231- const updateData = buildProjectUpdateData ( nonHomeProject , {
232- projectName : `Should Not Update ${ Date . now ( ) } ` ,
233- } ) ;
234-
235- try {
236- const response = await request
237- . put ( `/v2/project/${ nonHomeProject . cadTrustProjectId } ` )
238- . send ( updateData ) ;
239-
240- expect ( response . status ) . to . equal ( 400 ) ;
241- expect ( response . body . success ) . to . be . false ;
242- expect ( response . body . error ) . to . include ( 'Restricted data' ) ;
243- } finally {
244- await clearStagingTable ( request ) ;
245- }
246- } ) ;
247-
248181 it ( 'should update a project' , async function ( ) {
249182 // Get ID from createdIds (if available) or query for test records we created
250183 let id = createdIds [ 0 ] ;
@@ -358,11 +291,6 @@ describe('Project Live API Validation Tests', function () {
358291 }
359292 } ) ;
360293
361- it ( 'should include synced project data from another organization' , async function ( ) {
362- const nonHomeProject = await requireNonHomeProject ( request , homeOrgId , this ) ;
363- expect ( nonHomeProject . orgUid ) . to . not . equal ( homeOrgId ) ;
364- } ) ;
365-
366294 it ( 'should support search functionality' , async function ( ) {
367295 // Test search if supported by endpoint
368296 const response = await request
@@ -374,21 +302,6 @@ describe('Project Live API Validation Tests', function () {
374302 } ) ;
375303 } ) ;
376304 describe ( 'Step 9: DELETE Request Tests' , function ( ) {
377- it ( 'should reject deleting a project not owned by the home organization' , async function ( ) {
378- const nonHomeProject = await requireNonHomeProject ( request , homeOrgId , this ) ;
379-
380- try {
381- const response = await request
382- . delete ( `/v2/project/${ nonHomeProject . cadTrustProjectId } ` ) ;
383-
384- expect ( response . status ) . to . equal ( 400 ) ;
385- expect ( response . body . success ) . to . be . false ;
386- expect ( response . body . error ) . to . include ( 'Restricted data' ) ;
387- } finally {
388- await clearStagingTable ( request ) ;
389- }
390- } ) ;
391-
392305 it ( 'should delete all created projects' , async function ( ) {
393306 // Query for test projects by orgUid and TEST- prefix
394307 // This works even when DELETE runs in a separate process
0 commit comments