Skip to content

Commit

Permalink
Merge pull request #58 from OctopusDeploy/fix/tests
Browse files Browse the repository at this point in the history
feat: updated tests and functionality
  • Loading branch information
jbristowe committed Jun 27, 2022
2 parents d8ecdbd + 332017b commit 59679d8
Show file tree
Hide file tree
Showing 19 changed files with 341 additions and 324 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
.DS_Store
dist
node_modules
reports
*.tgz
.idea
40 changes: 25 additions & 15 deletions examples/src/releases/create-and-deploy-release.ts
@@ -1,19 +1,29 @@
import { Client, ClientConfiguration, Repository } from '@octopusdeploy/api-client';
import { ChannelResource, DeploymentProcessResource, DeploymentResource, EnvironmentResource, NewDeploymentResource, NewReleaseResource, ProjectResource, ReleaseResource, ReleaseTemplateResource } from '@octopusdeploy/message-contracts';
import { Client, ClientConfiguration, Repository } from "@octopusdeploy/api-client";
import {
ChannelResource,
DeploymentProcessResource,
DeploymentResource,
EnvironmentResource,
NewDeploymentResource,
NewReleaseResource,
ProjectResource,
ReleaseResource,
ReleaseTemplateResource,
} from "@octopusdeploy/message-contracts";

const main = async () => {
const configuration: ClientConfiguration = {
apiKey: 'api-key', // required
apiUri: 'api-uri', // required
autoConnect: true
apiKey: "api-key", // required
apiUri: "api-uri", // required
autoConnect: true,
};

let client: Client | undefined;

try {
client = await Client.create(configuration);
} catch (error) {
console.error('The TypeScript API client could not be constructed.');
console.error("The TypeScript API client could not be constructed.");
return;
}

Expand All @@ -22,9 +32,9 @@ const main = async () => {
}

const repository = new Repository(client);
const projectNameOrId = 'project-name-or-id';
const channelNameOrId = 'channel-name-or-id';
const environmentNameOrId = 'environment-name-or-id';
const projectNameOrId = "project-name-or-id";
const channelNameOrId = "channel-name-or-id";
const environmentNameOrId = "environment-name-or-id";

let project: ProjectResource | undefined;

Expand Down Expand Up @@ -108,8 +118,8 @@ const main = async () => {
let newRelease: NewReleaseResource = {
ChannelId: channel.Id,
ProjectId: project.Id,
Version: releaseTemplate.NextVersionIncrement
}
Version: releaseTemplate.NextVersionIncrement,
};

console.log(`Creating release with version, "${newRelease.Version}"...`);

Expand All @@ -126,8 +136,8 @@ const main = async () => {

let newDeployment: NewDeploymentResource = {
EnvironmentId: environment.Id,
ReleaseId: release.Id
}
ReleaseId: release.Id,
};

console.log(`Creating deployment for release ${release.Version} of project ${project.Name} to environment ${environment.Name}...`);

Expand All @@ -141,6 +151,6 @@ const main = async () => {
}

console.log(`Deployment created, "${deployment.Id}"`);
}
};

main();
main();
46 changes: 15 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Expand Up @@ -39,16 +39,15 @@
"jest-environment-jsdom": "^28.1.1",
"jest-expect-message": "^1.0.2",
"jest-extended": "^2.0.0",
"jest-junit": "^13.2.0",
"jest-junit": "^14.0.0",
"jest-runner-eslint": "^1.0.1",
"prettier": "^2.7.1",
"process": "^0.11.10",
"prop-types": "^15.8.1",
"ts-jest": "^28.0.5",
"ts-node": "^10.8.1",
"typedoc": "^0.22.17",
"typescript": "^4.7.4",
"unique-names-generator": "^4.7.1"
"typedoc": "^0.22.18",
"typescript": "^4.7.4"
},
"files": [
"dist/**/*"
Expand Down

0 comments on commit 59679d8

Please sign in to comment.