Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lou1415926 committed Nov 19, 2021
1 parent 7e6cae4 commit b4225e4
Showing 1 changed file with 9 additions and 80 deletions.
89 changes: 9 additions & 80 deletions cf-custom-resources/test/nlb-cert-validator-uptator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ describe("DNS Certificate Validation And Custom Domains for NLB", () => {
Key: "copilot-environment",
Value: mockEnvName,
},
{
Key: "copilot-service",
Value: mockServiceName,
},
],
ValidationMethod: "DNS",
}));
Expand Down Expand Up @@ -236,22 +240,7 @@ describe("DNS Certificate Validation And Custom Domains for NLB", () => {
MaxItems: "1",
StartRecordName: 'dash-test.mockDomain.com' // NOTE: JS set has the same iteration order: insertion order.
}));
sinon.assert.calledWith(mockRequestCertificate, sinon.match({
DomainName: `${mockServiceName}-nlb.${mockEnvName}.${mockAppName}.${mockDomainName}`,
IdempotencyToken: "/web/dash-test.mockDomain.com,frontend.mockDomain.com,frontend.v2.mockDomain.com",
SubjectAlternativeNames: ["dash-test.mockDomain.com","frontend.mockDomain.com","frontend.v2.mockDomain.com"],
Tags: [
{
Key: "copilot-application",
Value: mockAppName,
},
{
Key: "copilot-environment",
Value: mockEnvName,
},
],
ValidationMethod: "DNS",
}));
sinon.assert.callCount(mockRequestCertificate, 1);
sinon.assert.calledWith(mockDescribeCertificate, sinon.match({
"CertificateArn": "mockCertArn",
}));
Expand Down Expand Up @@ -289,22 +278,7 @@ describe("DNS Certificate Validation And Custom Domains for NLB", () => {
MaxItems: "1",
StartRecordName: 'dash-test.mockDomain.com' // NOTE: JS set has the same iteration order: insertion order.
}));
sinon.assert.calledWith(mockRequestCertificate, sinon.match({
DomainName: `${mockServiceName}-nlb.${mockEnvName}.${mockAppName}.${mockDomainName}`,
IdempotencyToken: "/web/dash-test.mockDomain.com,frontend.mockDomain.com,frontend.v2.mockDomain.com",
SubjectAlternativeNames: ["dash-test.mockDomain.com","frontend.mockDomain.com","frontend.v2.mockDomain.com"],
Tags: [
{
Key: "copilot-application",
Value: mockAppName,
},
{
Key: "copilot-environment",
Value: mockEnvName,
},
],
ValidationMethod: "DNS",
}));
sinon.assert.callCount(mockRequestCertificate, 1);
sinon.assert.calledWith(mockDescribeCertificate, sinon.match({
"CertificateArn": "mockCertArn",
}));
Expand Down Expand Up @@ -378,22 +352,7 @@ describe("DNS Certificate Validation And Custom Domains for NLB", () => {
MaxItems: "1",
StartRecordName: 'dash-test.mockDomain.com' // NOTE: JS set has the same iteration order: insertion order.
}));
sinon.assert.calledWith(mockRequestCertificate, sinon.match({
DomainName: `${mockServiceName}-nlb.${mockEnvName}.${mockAppName}.${mockDomainName}`,
IdempotencyToken: "/web/dash-test.mockDomain.com,frontend.mockDomain.com,frontend.v2.mockDomain.com",
SubjectAlternativeNames: ["dash-test.mockDomain.com","frontend.mockDomain.com","frontend.v2.mockDomain.com"],
Tags: [
{
Key: "copilot-application",
Value: mockAppName,
},
{
Key: "copilot-environment",
Value: mockEnvName,
},
],
ValidationMethod: "DNS",
}));
sinon.assert.callCount(mockRequestCertificate, 1);
sinon.assert.calledWith(mockDescribeCertificate, sinon.match({
"CertificateArn": "mockCertArn",
}));
Expand Down Expand Up @@ -520,22 +479,7 @@ describe("DNS Certificate Validation And Custom Domains for NLB", () => {
MaxItems: "1",
StartRecordName: 'dash-test.mockDomain.com' // NOTE: JS set has the same iteration order: insertion order.
}));
sinon.assert.calledWith(mockRequestCertificate, sinon.match({
DomainName: `${mockServiceName}-nlb.${mockEnvName}.${mockAppName}.${mockDomainName}`,
IdempotencyToken: "/web/dash-test.mockDomain.com,frontend.mockDomain.com,frontend.v2.mockDomain.com",
SubjectAlternativeNames: ["dash-test.mockDomain.com","frontend.mockDomain.com","frontend.v2.mockDomain.com"],
Tags: [
{
Key: "copilot-application",
Value: mockAppName,
},
{
Key: "copilot-environment",
Value: mockEnvName,
},
],
ValidationMethod: "DNS",
}));
sinon.assert.callCount(mockRequestCertificate, 1);
sinon.assert.calledWith(mockDescribeCertificate, sinon.match({
"CertificateArn": "mockCertArn",
}));
Expand Down Expand Up @@ -615,22 +559,7 @@ describe("DNS Certificate Validation And Custom Domains for NLB", () => {
MaxItems: "1",
StartRecordName: 'dash-test.mockDomain.com' // NOTE: JS set has the same iteration order: insertion order.
}));
sinon.assert.calledWith(mockRequestCertificate, sinon.match({
DomainName: `${mockServiceName}-nlb.${mockEnvName}.${mockAppName}.${mockDomainName}`,
IdempotencyToken: "/web/dash-test.mockDomain.com,frontend.mockDomain.com,frontend.v2.mockDomain.com",
SubjectAlternativeNames: ["dash-test.mockDomain.com","frontend.mockDomain.com","frontend.v2.mockDomain.com"],
Tags: [
{
Key: "copilot-application",
Value: mockAppName,
},
{
Key: "copilot-environment",
Value: mockEnvName,
},
],
ValidationMethod: "DNS",
}));
sinon.assert.callCount(mockRequestCertificate, 1);
sinon.assert.calledWith(mockDescribeCertificate, sinon.match({
"CertificateArn": "mockCertArn",
}));
Expand Down

0 comments on commit b4225e4

Please sign in to comment.