Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/4 update push element in test case #30

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/vue-scanner.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { resolve, join, dirname, extname, basename } from "path";
import { existsSync, readFileSync, mkdirSync, writeFileSync, rmSync } from "fs";
import { homedir } from "os";
import countBy from "lodash/countBy";

import groupBy from "lodash/groupBy";
import map from "lodash/map";

import mapValues from "lodash/mapValues";
import omit from "lodash/omit";
import {
Expand Down Expand Up @@ -777,11 +777,11 @@ export class VueScanner implements Scanner {
}

/**
* Write an array of component profiles to a JSON file within the specified app directory.
* Write an array of component profiles to a JSON file within the specified app directory.

* @param componentProfiles An array of component profiles to be written to the file.
* @returns The path of the file where the component profiles were written.
*/
* @param componentProfiles An array of component profiles to be written to the file.
* @returns The path of the file where the component profiles were written.
*/
async writeComponentProfilesToJson(
componentProfiles: ComponentProfile[]
): Promise<string> {
Expand Down
41 changes: 21 additions & 20 deletions tests/analyze-component-files.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,27 +222,28 @@ describe("Remove duplicate components", () => {
usageLocations: [],
groups: [],
children: { total: 1, tags: ["Button"], source: "" },
});
// Push 2nd object
componentProfiles.push({
name: "Button",
type: "internal",
total: 0,
source: {
path: "C:/projects/berryjam-cli/public/Components/Header.js",
property: {
dataLastModified: "Fri Apr 28 2023",
lastModified: "Fri Apr 28 2023",
created: "2023-04-17T04:04:04.000Z",
createdBy: "system",
updatedBy: "system",
},
// Push 2nd object

{
name: "Button",
type: "internal",
total: 0,
source: {
path: "C:/projects/berryjam-cli/public/Components/Header.js",
property: {
dataLastModified: "Fri Apr 28 2023",
lastModified: "Fri Apr 28 2023",
created: "2023-04-17T04:04:04.000Z",
createdBy: "system",
updatedBy: "system",
},
},
},
properties: [],
usageLocations: [],
groups: [],
children: { total: 1, tags: ["Button"], source: "" },
});
properties: [],
usageLocations: [],
groups: [],
children: { total: 1, tags: ["Button"], source: "" },
});

const received = vueScanner.removeDuplicateComponents(componentProfiles);
expect(received).toHaveLength(1);
Expand Down