Skip to content

Commit

Permalink
Revert "WIP"
Browse files Browse the repository at this point in the history
This reverts commit 74196ae.
  • Loading branch information
gloriateodoro committed Jun 22, 2022
1 parent d39391d commit 2702650
Showing 1 changed file with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ describe('FormPanel tests', () => {

it('should render for subdomain and domain form only ns_ok true', () => {
const hostedZones = [
{ domain_name: 'nossas.org', is_external_domain: false, ns_ok: true, community_id: 4 },
{ domain_name: 'nossas.link', is_external_domain: false, ns_ok: false, community_id: 4 },
{ domain_name: 'external.link', is_external_domain: true, ns_ok: false, community_id: 4 }
{ domain_name: 'nossas.org', is_external_domain: false, ns_ok: true },
{ domain_name: 'nossas.link', is_external_domain: false, ns_ok: false },
{ domain_name: 'external.link', is_external_domain: true, ns_ok: false }
]

wrapper = shallow(<FormPanel mobilization={mobilization} hostedZones={hostedZones} />);
Expand All @@ -123,7 +123,7 @@ describe('FormPanel tests', () => {

it('should call only updateMobilization if isExternalDomain false', async () => {
const hostedZones = [
{ domain_name: 'nossas.org', is_external_domain: false, ns_ok: true, community_id: 4 }
{ domain_name: 'nossas.org', is_external_domain: false, ns_ok: true }
]
const customDomain = 'op.nossas.org';
wrapper = shallow(<FormPanel mobilization={mobilization} hostedZones={hostedZones} />);
Expand All @@ -143,12 +143,12 @@ describe('FormPanel tests', () => {
}
});

expect(mockCreateDnsHostedZone?.mock.calls.length)?.toEqual(0);
expect(mockCreateDnsHostedZone.mock.calls.length).toEqual(0);
});

it('should call createDnsHostedZone and updateMobilization if isExternalDomain true', async () => {
mockCreateDnsHostedZone.mockResolvedValueOnce({ data: {} });
const customDomain = 'testeee.link';
const customDomain = 'asdasdas.org';
wrapper = shallow(<FormPanel mobilization={mobilization} hostedZones={[]} />);
// find ExternalDomainForm inside TabPanel
const form = wrapper
Expand All @@ -158,12 +158,12 @@ describe('FormPanel tests', () => {

await form.props().onSubmit({ customDomain, isExternalDomain: true });

// expect(mockCreateDnsHostedZone.mock.calls[0][0]).toEqual({
// // variables: {
// // comment: `mobilization_id:${mobilization.id}`,
// // customDomain: customDomain
// // }
// // });
expect(mockCreateDnsHostedZone.mock.calls[0][0]).toEqual({
variables: {
comment: `mobilization_id:${mobilization.id}`,
customDomain: customDomain
}
});
expect(mockUpdateMobilization.mock.calls.length).toEqual(1);
});

Expand All @@ -180,7 +180,7 @@ describe('FormPanel tests', () => {

await form.props().onSubmit({ customDomain, isExternalDomain: true });

expect(mockUpdateMobilization.mock.calls.length).toEqual(1);
expect(mockUpdateMobilization.mock.calls.length).toEqual(0);
// Expect call toast failed message
expect(mockToast.mock.calls[0][0]).toEqual({
title: 'Falha ao atualizar o domínio',
Expand All @@ -190,9 +190,8 @@ describe('FormPanel tests', () => {
});
});

//TEST ERROR: RECEBE MSG DE ERRO QND DEVERIA RECEBER DE SUCESSO
it('should call updateDnsHostedZone IP is configured', async () => {
const customDomain = 'nossasssss.link';
const customDomain = 'asdasdas.org';
mockCheckDNS.mockResolvedValueOnce(true);
mockCreateDnsHostedZone.mockResolvedValueOnce({
data: {
Expand Down Expand Up @@ -226,7 +225,7 @@ describe('FormPanel tests', () => {

await form.props().onSubmit({ customDomain, isExternalDomain: true });

expect(mockUpdateMobilization.mock.calls.length).toEqual(0);
expect(mockUpdateMobilization.mock.calls.length).toEqual(1);
// Expect call toast success message
expect(mockToast.mock.calls[0][0]).toEqual({
title: 'Domínio registrado com sucesso!',
Expand All @@ -237,8 +236,8 @@ describe('FormPanel tests', () => {

it('should call updateDnsHostedZone if dns is ok', async () => {
const hostedZones = [
{ id: 14, domain_name: 'nossas.link', is_external_domain: false, name_servers: ['ok.dasd-ws.org', 'tsd-12.dasd-ws.uk'], ns_ok: false, community_id: 4 },
{ id: 13, domain_name: 'outrodominio.org', is_external_domain: true, ns_ok: true, community_id: 4 }
{ id: 14, domain_name: 'nossas.link', is_external_domain: false, name_servers: ['ok.dasd-ws.org', 'tsd-12.dasd-ws.uk'], ns_ok: false },
{ id: 13, domain_name: 'outrodominio.org', is_external_domain: true, ns_ok: true }
]
const customDomain = 'campanha.nossas.link';
mockCheckDNS.mockResolvedValueOnce(true);
Expand Down Expand Up @@ -280,8 +279,8 @@ describe('FormPanel tests', () => {

it('should call createOrUpdateCertificate if dns is ok', async () => {
const hostedZones = [
{ id: 14, domain_name: 'nossas.link', is_external_domain: false, name_servers: ['ok.dasd-ws.org', 'tsd-12.dasd-ws.uk'], ns_ok: true, community_id: 4 },
{ id: 13, domain_name: 'outrodominio.org', is_external_domain: true, ns_ok: true, community_id: 4 }
{ 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';
mockCheckDNS.mockResolvedValueOnce(true);
Expand Down Expand Up @@ -331,7 +330,7 @@ describe('FormPanel tests', () => {
describe('select tab when mobilization custom domain is preset', () => {

it('should select subdomain tab', () => {
const hostedZones = [{ domain_name: 'nossas.link', is_external_domain: false, ns_ok: true, community_id: 4 }]
const hostedZones = [{ domain_name: 'nossas.link', is_external_domain: false, ns_ok: true }]

wrapper = shallow(
<FormPanel
Expand All @@ -344,7 +343,7 @@ describe('FormPanel tests', () => {
});

it('should select root domain tab', () => {
const hostedZones = [{ domain_name: 'nossas.link', is_external_domain: false, ns_ok: true, community_id: 4 }]
const hostedZones = [{ domain_name: 'nossas.link', is_external_domain: false, ns_ok: true }]

wrapper = shallow(
<FormPanel
Expand All @@ -357,7 +356,7 @@ describe('FormPanel tests', () => {
});

it('should select external domain tab', () => {
const hostedZones = [{ domain_name: 'nossas.link', community_id: 4 }]
const hostedZones = [{ domain_name: 'nossas.link' }]

wrapper = shallow(
<FormPanel
Expand Down

0 comments on commit 2702650

Please sign in to comment.