Skip to content

Commit

Permalink
fix: implicit component were not created with the correct name
Browse files Browse the repository at this point in the history
  • Loading branch information
bodinsamuel committed Sep 3, 2023
1 parent 5a22fa0 commit 234b4cc
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 52 deletions.
98 changes: 49 additions & 49 deletions src/analyser/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ exports[`analyser > should run correctly 1`] = `
"id": "18",
"inComponent": null,
"languages": {},
"name": "datadog",
"name": "Datadog",
"path": [
"/pkgs/api/package.json",
],
Expand Down Expand Up @@ -208,7 +208,7 @@ exports[`analyser > should run correctly 1`] = `
"id": "20",
"inComponent": null,
"languages": {},
"name": "vercel",
"name": "Vercel",
"path": [
"/pkgs/app/package.json",
],
Expand Down Expand Up @@ -292,6 +292,23 @@ exports[`analyser > should run correctly 1`] = `
"tech": "gcp",
"techs": [],
},
{
"childs": [],
"dependencies": [],
"edges": [],
"id": "14",
"inComponent": null,
"languages": {},
"name": "Postgres",
"path": [
"/deno/deno.lock",
],
"reason": [
"postgresql matched: /\\\\/x\\\\/postgres@/",
],
"tech": "postgresql",
"techs": [],
},
{
"childs": [],
"dependencies": [
Expand All @@ -315,23 +332,6 @@ exports[`analyser > should run correctly 1`] = `
"tech": "vercel",
"techs": [],
},
{
"childs": [],
"dependencies": [],
"edges": [],
"id": "14",
"inComponent": null,
"languages": {},
"name": "postgresql",
"path": [
"/deno/deno.lock",
],
"reason": [
"postgresql matched: /\\\\/x\\\\/postgres@/",
],
"tech": "postgresql",
"techs": [],
},
{
"childs": [],
"dependencies": [
Expand Down Expand Up @@ -644,6 +644,21 @@ exports[`analyser > should run correctly 2`] = `
"vite",
],
},
{
"childs": [],
"dependencies": [],
"edges": [],
"id": "18",
"inComponent": null,
"languages": {},
"name": "Datadog",
"path": [
"/pkgs/api/package.json",
],
"reason": [],
"tech": "datadog",
"techs": [],
},
{
"childs": [],
"dependencies": [
Expand All @@ -667,18 +682,27 @@ exports[`analyser > should run correctly 2`] = `
},
{
"childs": [],
"dependencies": [],
"dependencies": [
[
"terraform",
"registry.terraform.io/vercel/vercel",
"4.61.0",
],
],
"edges": [],
"id": "18",
"id": "20",
"inComponent": null,
"languages": {},
"name": "datadog",
"name": "Vercel",
"path": [
"/pkgs/api/package.json",
"/pkgs/app/package.json",
"/terraform/.terraform.lock.hcl",
],
"reason": [],
"tech": "datadog",
"techs": [],
"tech": "vercel",
"techs": [
"vercel",
],
},
{
"childs": [],
Expand Down Expand Up @@ -881,30 +905,6 @@ exports[`analyser > should run correctly 2`] = `
"tech": null,
"techs": [],
},
{
"childs": [],
"dependencies": [
[
"terraform",
"registry.terraform.io/vercel/vercel",
"4.61.0",
],
],
"edges": [],
"id": "20",
"inComponent": null,
"languages": {},
"name": "vercel",
"path": [
"/pkgs/app/package.json",
"/terraform/.terraform.lock.hcl",
],
"reason": [],
"tech": "vercel",
"techs": [
"vercel",
],
},
],
"dependencies": [
[
Expand Down
4 changes: 2 additions & 2 deletions src/analyser/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ describe('analyser', () => {
const flatted = flatten(res, { merge: true });

// Check that inComponent was updated
const vercel = flatted.childs.find((child) => child.name === 'vercel')!;
const vercel = flatted.childs.find((child) => child.name === 'Vercel')!;
const app = flatted.childs.find((child) => child.name === '@fake/app');
expect(app!.inComponent!.id).toBe(vercel.id);

// Check that edge.target was updated
const datadog = flatted.childs.find((child) => child.name === 'datadog')!;
const datadog = flatted.childs.find((child) => child.name === 'Datadog')!;
const api = flatted.childs.find((child) => child.name === '@fake/api');
expect(api!.edges[0].target.id).toBe(datadog.id);

Expand Down
2 changes: 1 addition & 1 deletion src/payload/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function findImplicitComponent(
}

const comp = new Payload({
name: tech,
name: ref.name,
tech: tech,
folderPath: pl.path[0],
parent: pl,
Expand Down

0 comments on commit 234b4cc

Please sign in to comment.