fix: update example descriptions to make them more descriptive

Signed-off-by: Billy Michael <billy_michael@outlook.com>
This commit is contained in:
Billy Michael
2024-03-27 21:30:01 +01:00
parent 8dd33a1d08
commit b65517bf44
2 changed files with 72 additions and 13 deletions
@@ -194,7 +194,7 @@ describe('publish:bitbucketCloud', () => {
remoteUrl: 'https://bitbucket.org/workspace/cloneurl',
auth: { username: 'x-token-auth', password: 'your-default-auth-token' },
logger: mockContext.logger,
defaultBranch: 'main',
defaultBranch: 'master',
commitMessage: 'initial commit',
gitAuthorInfo: {
email: 'test_user@BackstageBackend.com',
@@ -232,6 +232,49 @@ describe('publish:bitbucketCloud', () => {
...mockContext,
input: yaml.parse(examples[5].example).steps[0].input,
});
expect(initRepoAndPush).toHaveBeenCalledWith({
dir: mockContext.workspacePath,
remoteUrl: 'https://bitbucket.org/workspace/cloneurl',
auth: { username: 'x-token-auth', password: 'your-custom-auth-token' },
logger: mockContext.logger,
defaultBranch: 'master',
commitMessage: 'initial commit',
gitAuthorInfo: {
email: 'test_user@BackstageBackend.com',
name: 'test_user',
},
});
});
it('should call initAndPush with all available custom inputs', async () => {
server.use(
rest.post(
'https://api.bitbucket.org/2.0/repositories/workspace/repo',
(_, res, ctx) =>
res(
ctx.status(200),
ctx.set('Content-Type', 'application/json'),
ctx.json({
links: {
html: {
href: 'https://bitbucket.org/workspace/repo',
},
clone: [
{
name: 'https',
href: 'https://bitbucket.org/workspace/cloneurl',
},
],
},
}),
),
),
);
await action.handler({
...mockContext,
input: yaml.parse(examples[6].example).steps[0].input,
});
expect(initRepoAndPush).toHaveBeenCalledWith({
dir: mockContext.workspacePath,
remoteUrl: 'https://bitbucket.org/workspace/cloneurl',
@@ -20,7 +20,7 @@ import yaml from 'yaml';
export const examples: TemplateExample[] = [
{
description:
'Initializes a git repository of contents in workspace and publish it to Bitbucket Cloud with default configuration.',
'Initializes a git repository and publishes it to Bitbucket Cloud with the default configuration.',
example: yaml.stringify({
steps: [
{
@@ -36,7 +36,7 @@ export const examples: TemplateExample[] = [
}),
},
{
description: 'Add a description.',
description: 'Initializes a git repository with a custom description.',
example: yaml.stringify({
steps: [
{
@@ -53,7 +53,8 @@ export const examples: TemplateExample[] = [
}),
},
{
description: 'Change visibility of the repository.',
description:
'Initializes a git repository and sets repo visibility to public.',
example: yaml.stringify({
steps: [
{
@@ -63,7 +64,6 @@ export const examples: TemplateExample[] = [
input: {
repoUrl:
'bitbucket.org?repo=repo&workspace=workspace&project=project',
description: 'Initialize a git repository',
repoVisibility: 'public',
},
},
@@ -71,7 +71,8 @@ export const examples: TemplateExample[] = [
}),
},
{
description: 'Set the default branch.',
description:
'Initializes a git repository and sets default branch to main.',
example: yaml.stringify({
steps: [
{
@@ -81,8 +82,6 @@ export const examples: TemplateExample[] = [
input: {
repoUrl:
'bitbucket.org?repo=repo&workspace=workspace&project=project',
description: 'Initialize a git repository',
repoVisibility: 'public',
defaultBranch: 'main',
},
},
@@ -90,7 +89,8 @@ export const examples: TemplateExample[] = [
}),
},
{
description: 'Specify a source path within the workspace.',
description:
'Initializes a git repository with the contents of the specified path.',
example: yaml.stringify({
steps: [
{
@@ -100,9 +100,6 @@ export const examples: TemplateExample[] = [
input: {
repoUrl:
'bitbucket.org?repo=repo&workspace=workspace&project=project',
description: 'Initialize a git repository',
repoVisibility: 'public',
defaultBranch: 'main',
sourcePath: './repoRoot',
},
},
@@ -110,7 +107,26 @@ export const examples: TemplateExample[] = [
}),
},
{
description: 'Provide an authentication token for Bitbucket.',
description:
'Initializes a git repository using a custom authentication token',
example: yaml.stringify({
steps: [
{
id: 'publish',
action: 'publish:bitbucketCloud',
name: 'Publish to Bitbucket Cloud',
input: {
repoUrl:
'bitbucket.org?repo=repo&workspace=workspace&project=project',
token: 'your-custom-auth-token',
},
},
],
}),
},
{
description:
'Initializes a git repository using all of the custom options together',
example: yaml.stringify({
steps: [
{