Skip to content

Commit

Permalink
add serializer mutation test
Browse files Browse the repository at this point in the history
  • Loading branch information
danjuv committed Aug 23, 2021
1 parent 24a1f03 commit cf7e1a6
Show file tree
Hide file tree
Showing 11 changed files with 686 additions and 31 deletions.
4 changes: 2 additions & 2 deletions examples/mutate_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ async function commandFn(entity: Step) {
}
}

new YamlSerializer({ explicitDependencies: true })
.serialize(pipeline, commandFn)
new YamlSerializer({ explicitDependencies: true, mutator: commandFn })
.serialize(pipeline)
.then(console.log);
88 changes: 88 additions & 0 deletions src/__tests__/__snapshots__/block.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ Object {
}
`;

exports[`buildkite-graph Steps Block branches mutate 1`] = `
"steps:
- branches: '!release/* master stable/*'
block: my title
"
`;

exports[`buildkite-graph Steps Block branches structure 1`] = `"* [block for 'my title']"`;

exports[`buildkite-graph Steps Block branches yaml 1`] = `
Expand Down Expand Up @@ -120,6 +127,19 @@ Object {
}
`;

exports[`buildkite-graph Steps Block can be added mutate 1`] = `
"steps:
- block: ':rocket: Release!'
"
`;

exports[`buildkite-graph Steps Block can be added mutate 2`] = `
"steps:
- block: ':rocket: Release!'
prompt: Release to production?
"
`;

exports[`buildkite-graph Steps Block can be added structure 1`] = `"* [block for ':rocket: Release!']"`;

exports[`buildkite-graph Steps Block can be added structure 2`] = `"* [block for ':rocket: Release!']"`;
Expand Down Expand Up @@ -434,6 +454,74 @@ Object {
}
`;

exports[`buildkite-graph Steps Block with fields mutate 1`] = `
"steps:
- block: my title
fields:
- key: field-1
text: Label 1
- key: field-2
options: []
select: Label 2
- key: field-3
text: Label 3
"
`;

exports[`buildkite-graph Steps Block with fields mutate 2`] = `
"steps:
- block: my title
fields:
- key: release-name
hint: 'What’s the code name for this release? :name_badge:'
required: false
text: Code Name
default: Flying Dolphin
"
`;

exports[`buildkite-graph Steps Block with fields mutate 3`] = `
"steps:
- block: my title
fields:
- key: release-stream
hint: What’s the release stream?
required: false
options:
- label: Beta
value: beta
- label: Stable
value: stable
select: Stream
default: beta
"
`;

exports[`buildkite-graph Steps Block with fields mutate 4`] = `
"steps:
- block: my title
fields:
- key: regions
hint: 'Which regions should we deploy this to? :earth_asia:'
options:
- label: North America
value: na
- label: Europe
value: eur
- label: Asia
value: asia
- label: Oceania
value: aunz
select: Regions
default:
- na
- eur
- asia
- aunz
multiple: true
"
`;

exports[`buildkite-graph Steps Block with fields structure 1`] = `"* [block for 'my title']"`;

exports[`buildkite-graph Steps Block with fields structure 2`] = `"* [block for 'my title']"`;
Expand Down
Loading

0 comments on commit cf7e1a6

Please sign in to comment.