update tests and API reports

Signed-off-by: Christopher Diaz <codingdiaz@icloud.com>
This commit is contained in:
Christopher Diaz
2024-06-20 17:10:40 -04:00
parent 70c4b3625d
commit fc6db7af1d
3 changed files with 51 additions and 0 deletions
@@ -77,6 +77,7 @@ export function createGithubEnvironmentAction(options: {
}
| undefined;
customBranchPolicyNames?: string[] | undefined;
customTagPolicyNames?: string[] | undefined;
environmentVariables?:
| {
[key: string]: string;
@@ -171,6 +171,7 @@ describe('github:environment:create examples', () => {
repo: 'repository',
environment_name: 'envname',
name: 'main',
type: 'branch',
});
expect(
@@ -180,6 +181,7 @@ describe('github:environment:create examples', () => {
repo: 'repository',
environment_name: 'envname',
name: '*.*.*',
type: 'branch',
});
expect(
@@ -121,6 +121,7 @@ describe('github:environment:create', () => {
},
});
});
it('should work specify deploymentBranchPolicy custom', async () => {
await action.handler({
...mockContext,
@@ -153,6 +154,7 @@ describe('github:environment:create', () => {
repo: 'repository',
environment_name: 'envname',
name: 'main',
type: 'branch',
});
expect(
mockOctokit.rest.repos.createDeploymentBranchPolicy,
@@ -161,6 +163,52 @@ describe('github:environment:create', () => {
repo: 'repository',
environment_name: 'envname',
name: '*.*.*',
type: 'branch',
});
});
it('should work specify deploymentTagPolicy custom', async () => {
await action.handler({
...mockContext,
input: {
...mockContext.input,
deploymentBranchPolicy: {
protected_branches: false,
custom_branch_policies: true,
},
customTagPolicyNames: ['main', '*.*.*'],
},
});
expect(
mockOctokit.rest.repos.createOrUpdateEnvironment,
).toHaveBeenCalledWith({
owner: 'owner',
repo: 'repository',
environment_name: 'envname',
deployment_branch_policy: {
protected_branches: false,
custom_branch_policies: true,
},
});
expect(
mockOctokit.rest.repos.createDeploymentBranchPolicy,
).toHaveBeenCalledWith({
owner: 'owner',
repo: 'repository',
environment_name: 'envname',
name: 'main',
type: 'tag',
});
expect(
mockOctokit.rest.repos.createDeploymentBranchPolicy,
).toHaveBeenCalledWith({
owner: 'owner',
repo: 'repository',
environment_name: 'envname',
name: '*.*.*',
type: 'tag',
});
});