-
Notifications
You must be signed in to change notification settings - Fork 3.7k
/
test.bitbucket-source-action.ts
76 lines (71 loc) · 2.24 KB
/
test.bitbucket-source-action.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { expect, haveResourceLike } from "@aws-cdk/assert";
import * as codebuild from '@aws-cdk/aws-codebuild';
import * as codepipeline from '@aws-cdk/aws-codepipeline';
import { Stack } from "@aws-cdk/core";
import { Test } from 'nodeunit';
import * as cpactions from '../../lib';
// tslint:disable:object-literal-key-quotes
export = {
'BitBucket source Action': {
'produces the correct configuration when added to a pipeline'(test: Test) {
const stack = new Stack();
const sourceOutput = new codepipeline.Artifact();
new codepipeline.Pipeline(stack, 'Pipeline', {
stages: [
{
stageName: 'Source',
actions: [
new cpactions.BitBucketSourceAction({
actionName: 'BitBucket',
owner: 'aws',
repo: 'aws-cdk',
output: sourceOutput,
connectionArn: 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh',
}),
],
},
{
stageName: 'Build',
actions: [
new cpactions.CodeBuildAction({
actionName: 'CodeBuild',
project: new codebuild.PipelineProject(stack, 'MyProject'),
input: sourceOutput,
}),
],
},
],
});
expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', {
"Stages": [
{
"Name": "Source",
"Actions": [
{
"Name": "BitBucket",
"ActionTypeId": {
"Owner": "AWS",
"Provider": "CodeStarSourceConnection",
},
"Configuration": {
"ConnectionArn": "arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh",
"FullRepositoryId": "aws/aws-cdk",
"BranchName": "master",
},
},
],
},
{
"Name": "Build",
"Actions": [
{
"Name": "CodeBuild",
},
],
},
],
}));
test.done();
},
},
};