Skip to content

Commit

Permalink
chore: update nuts
Browse files Browse the repository at this point in the history
  • Loading branch information
shetzel committed Jan 12, 2024
1 parent 5e68c24 commit a2627e2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 61 deletions.
82 changes: 21 additions & 61 deletions test/commands/package/packageVersion.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ import { CreateListCommandResult } from '../../../src/commands/package/version/c

chaiConfig.truncateThreshold = 0;

const expectedPVCRkeys = [
'Id',
'Status',
'Package2Id',
'Package2Name',
'Package2VersionId',
'SubscriberPackageVersionId',
'Tag',
'Branch',
'Error',
'CreatedDate',
'HasMetadataRemoved',
'HasPassedCodeCoverageCheck',
'CreatedBy',
'ConvertedFromVersionId',
];

describe('package:version:*', () => {
let session: TestSession;
let packageId: string | undefined;
Expand Down Expand Up @@ -80,20 +97,7 @@ describe('package:version:*', () => {
`package:version:create --package ${pkgName} --json --tag tag --branch branch -x --code-coverage --version-description "Initial version"`,
{ ensureExitCode: 0 }
).jsonOutput?.result;
expect(result).to.have.all.keys(
'Id',
'Status',
'Package2Id',
'Package2VersionId',
'SubscriberPackageVersionId',
'Tag',
'Branch',
'Error',
'CreatedDate',
'HasMetadataRemoved',
'CreatedBy',
'ConvertedFromVersionId'
);
expect(result).to.have.all.keys(expectedPVCRkeys);
packageVersionId = result?.Id;
expect(result?.Id).to.match(/08c.{15}/);
expect(result?.Package2Id).to.match(/0Ho.{15}/);
Expand Down Expand Up @@ -196,24 +200,10 @@ describe('package:version:*', () => {
it('should list all of the package versions created within the last 2 days', () => {
const command = `package:version:create:list --created-last-days 2 -v ${session.hubOrg.username} --json`;
const output = execCmd<CreateListCommandResult>(command, { ensureExitCode: 0 }).jsonOutput;
const keys = [
'Id',
'Status',
'Package2Id',
'Package2VersionId',
'SubscriberPackageVersionId',
'Tag',
'Branch',
'Error',
'CreatedDate',
'HasMetadataRemoved',
'CreatedBy',
'ConvertedFromVersionId',
];
expect(output).to.be.ok;
expect(output?.status).to.equal(0);
expect(output?.result).to.have.length.greaterThan(0);
expect(output?.result[0]).to.have.keys(keys);
expect(output?.result[0]).to.have.keys(expectedPVCRkeys);
const current = Date.now();
// @ts-ignore
const created = Date.parse(output?.result?.at(0).CreatedDate);
Expand All @@ -229,24 +219,10 @@ describe('package:version:*', () => {
it('should list the package versions created (json)', async () => {
const command = `package:version:create:list -v ${session.hubOrg.username} --json`;
const output = execCmd<CreateListCommandResult>(command, { ensureExitCode: 0 }).jsonOutput;
const keys = [
'Id',
'Status',
'Package2Id',
'Package2VersionId',
'SubscriberPackageVersionId',
'Tag',
'Branch',
'Error',
'CreatedDate',
'HasMetadataRemoved',
'CreatedBy',
'ConvertedFromVersionId',
];
expect(output).to.be.ok;
expect(output?.status).to.equal(0);
expect(output?.result).to.have.length.greaterThan(0);
expect(output?.result[0]).to.have.keys(keys);
expect(output?.result[0]).to.have.keys(expectedPVCRkeys);
});

it('should list the package versions created as part of package conversion from 1GP --show-conversions-only flag (human)', async () => {
Expand All @@ -260,26 +236,10 @@ describe('package:version:*', () => {
it('should list the package versions created --verbose (json)', async () => {
const command = `package:version:create:list --status Success --created-last-days 10 -v ${session.hubOrg.username} --json --verbose`;
const output = execCmd<CreateListCommandResult>(command, { ensureExitCode: 0 }).jsonOutput;
const keys = [
'Id',
'Status',
'Package2Id',
'Package2VersionId',
'SubscriberPackageVersionId',
'Tag',
'Branch',
'Error',
'CreatedDate',
'HasMetadataRemoved',
'CreatedBy',
'VersionName',
'VersionNumber',
'ConvertedFromVersionId',
];
expect(output).to.be.ok;
expect(output?.status).to.equal(0);
expect(output?.result).to.have.length.greaterThan(0);
expect(output?.result[0]).to.have.keys(keys);
expect(output?.result[0]).to.have.keys(expectedPVCRkeys);
});
});
describe('package:version:list', () => {
Expand Down
2 changes: 2 additions & 0 deletions test/commands/package/versionPromoteUpdate.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ describe('package:version:promote / package:version:update', () => {
'Id',
'Status',
'Package2Id',
'Package2Name',
'Package2VersionId',
'SubscriberPackageVersionId',
'Tag',
'Branch',
'Error',
'CreatedDate',
'HasMetadataRemoved',
'HasPassedCodeCoverageCheck',
'CreatedBy',
'ConvertedFromVersionId'
);
Expand Down

0 comments on commit a2627e2

Please sign in to comment.