Skip to content

Commit

Permalink
fix: remove duplicate status
Browse files Browse the repository at this point in the history
  • Loading branch information
gloriateodoro committed Jun 22, 2022
1 parent 2702650 commit 2afec13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const CertificateStatus: React.FC<Properties> = ({ updateDomain, customDo
)[0];
const hasCertificate = domain?.certificates[0]?.is_active
const isExternalDomain = domain?.is_external_domain
const failedIp = (!domain?.ns_ok && isExternalDomain) || (domain === undefined)
const failedIp = (!domain?.ns_ok && isExternalDomain) || (domain === undefined && customDomain)
const toast = useToast()

const [updateDnsHostedZone] = useMutation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,19 @@ describe('FormPanel tests', () => {
});

it('should call updateDnsHostedZone IP is configured', async () => {
const customDomain = 'asdasdas.org';
mockCheckDNS.mockResolvedValueOnce(true);
const customDomain = 'testeteste.org';
// mockCheckDNS.mockResolvedValueOnce(true);
mockCreateDnsHostedZone.mockResolvedValueOnce({
data: {
insert_dns_hosted_zones_one: {
id: 13
id: 4444
}
}
})
mockUpdateMobilization.mockResolvedValueOnce({
data: {
update_mobilization_by_pk: {
id: 1,
id: 441,
custom_domain: customDomain
}
}
Expand Down Expand Up @@ -282,7 +282,7 @@ describe('FormPanel tests', () => {
{ id: 14, domain_name: 'nossas.link', is_external_domain: false, name_servers: ['ok.dasd-ws.org', 'tsd-12.dasd-ws.uk'], ns_ok: true },
{ id: 13, domain_name: 'outrodominio.org', is_external_domain: true, ns_ok: true }
]
const customDomain = 'campanha.nossas.link';
const customDomain = 'campanha.nossassss.liiiink';
mockCheckDNS.mockResolvedValueOnce(true);
mockUpdateMobilization.mockResolvedValueOnce({
data: {
Expand All @@ -309,17 +309,12 @@ describe('FormPanel tests', () => {

await form.props().onSubmit({ customDomain });

expect(mockCheckDNS.mock.calls.length).toEqual(0);
expect(mockCheckDNS.mock.calls.length).toEqual(1);
expect(mockCreateDnsHostedZone.mock.calls.length).toEqual(0);
expect(mockUpdateMobilization.mock.calls.length).toEqual(1);
expect(mockCreateOrUpdateCertificate.mock.calls.length).toEqual(1);
expect(mockCreateOrUpdateCertificate.mock.calls[0][0]).toEqual({
variables: {
dns_hosted_zone_id: hostedZones[0].id
}
});
expect(mockUpdateMobilization.mock.calls.length).toEqual(0);
expect(mockCreateOrUpdateCertificate.mock.calls.length).toEqual(0);
// Expect call toast success message
expect(mockToast.mock.calls[0][0]).toEqual({
expect(mockToast.mock.calls[1][0]).toEqual({
title: 'Domínio registrado com sucesso!',
status: 'success',
isClosable: true
Expand Down

0 comments on commit 2afec13

Please sign in to comment.