Skip to content

Commit

Permalink
test cases fixed and csv
Browse files Browse the repository at this point in the history
  • Loading branch information
cs-raj committed Mar 1, 2024
1 parent 5026eb2 commit 7f718a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 0 additions & 2 deletions packages/contentstack-audit/src/audit-base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
const tableValues = Object.values(missingRefs).flat();

const tableKeys = Object.keys(missingRefs[0]);

const arrayOfObjects = tableKeys.map((key) => {
if (['title', 'name', 'uid', 'content_types'].includes(key)) {
return {
Expand Down Expand Up @@ -350,7 +349,6 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
}

const rowData: Record<string, string | string[]>[] = [];

for (const issue of missingRefs) {
let row: Record<string, string | string[]> = {};

Expand Down
3 changes: 2 additions & 1 deletion packages/contentstack-audit/src/types/content-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type RefErrorReturnType = {
tree: Record<string, unknown>[];
uid?: string;
content_types?: string[];
title?: string;
};

// NOTE Type 1
Expand Down Expand Up @@ -115,7 +116,7 @@ enum OutputColumn {
'Field type' = 'data_type',
'Missing references' = 'missingRefs',
Path = 'treeStr',
content_types = 'content_types',
title = 'title',
'uid' = 'uid',
'missingCts' = 'content_types',
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fs from 'fs';
import { resolve } from 'path';
import { fancy } from 'fancy-test';
import { expect } from '@oclif/test';
Expand All @@ -8,12 +7,8 @@ import { ux } from '@contentstack/cli-utilities';
import config from '../../../src/config';
import { Extensions } from '../../../src/modules';
import { $t, auditMsg } from '../../../src/messages';
import { values } from 'lodash';
// import { spy } from '@contentstack/cli-dev-dependencies';
import sinon from 'sinon';
// import extensionsExamples from './../mock/contents/extensions/extensions.json';
import { Extension } from '../../../src/types';
// import { join } from 'path';

describe('Extensions scope containing content_types uids', () => {
describe('run method with invalid path for extensions', () => {
Expand Down Expand Up @@ -51,7 +46,7 @@ describe('Extensions scope containing content_types uids', () => {
.it(
'should expect missingRefs equal to empty array, expect entire workflow schema and empty missingCts',
async () => {
const missingRefs = await ext.run();
await ext.run();
expect(ext.missingCtInExtensions).eql([
{
stackHeaders: {
Expand Down Expand Up @@ -162,7 +157,7 @@ describe('Extensions scope containing content_types uids', () => {
.it(
'should expect missingRefs equal to empty array, expect entire workflow schema and empty missingCts',
async () => {
const missingRefs = await ext.run();
await ext.run();
expect(ext.missingCtInExtensions).eql([]);
expect(ext.missingCts).eql(new Set([]));
},
Expand Down

0 comments on commit 7f718a6

Please sign in to comment.