const url = process.env.GRAPHQL_URL ?? 'http://127.0.0.1:3000/graphql'; const query = `query { profile { name description skills { name } experience { company position } projects { name url } } }`; const response = await fetch(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ query }), }); const body = await response.json(); if (!response.ok || body.errors) { console.error(JSON.stringify(body, null, 2)); process.exit(1); } const profile = body.data.profile; const linked = profile.projects.some( (project) => typeof project.url === 'string' && project.url.includes('github.com'), ); if ( profile.name !== 'Илья Братских' || profile.skills.length === 0 || profile.experience.length === 0 || !linked ) { console.error(JSON.stringify(profile, null, 2)); process.exit(1); } console.log( `OK ${profile.name}: ${profile.skills.length} skills, ${profile.experience.length} jobs, ${profile.projects.length} projects`, );