Diff
checker
텍스트
텍스트
이미지
문서
Excel
폴더
Legal
Enterprise
데스크톱
요금제
로그인
데스크톱 앱 다운로드
텍스트 비교
두 텍스트 파일의 차이점을 찾아보세요
도구
기록
실시간 편집
공백 변경 숨기기
변경 없는 행 숨기기
줄바꿈 비활성화
레이아웃
나란히 보기
합쳐 보기
비교 단위
스마트
단어
글자
텍스트 스타일
모양 변경
구문 강조
언어 선택
제외
텍스트 변환
첫 변경으로
수정
Diffchecker Desktop
가장 안전하게 Diffchecker를 사용하는 방법. 데스크톱 앱을 사용하면 비교 데이터가 외부로 전송되지 않습니다!
데스크톱 앱 받기
Untitled diff
생성일
7년 전
비교 결과 만료 없음
초기화
내보내기
공유
설명
0 삭제
행
총
삭제
글자
총
삭제
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
74 행
복사
7 추가
행
총
추가
글자
총
추가
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
74 행
복사
/**
/**
* @format
* @format
* @jest-environment jsdom
* @jest-environment jsdom
*/
*/
/**
/**
* External dependencies
* External dependencies
*/
*/
import { shallow } from 'enzyme';
import { shallow } from 'enzyme';
import React from 'react';
import React from 'react';
import { identity, noop } from 'lodash';
import { identity, noop } from 'lodash';
/**
/**
* Internal dependencies
* Internal dependencies
*/
*/
복사
복사됨
복사
복사됨
import { CreditCardFormFields
} from '../';
import { CreditCardFormFields
UX
} from '../';
import { shouldRenderAdditionalCountryFields } from 'lib/checkout/processor-specific';
import { shouldRenderAdditionalCountryFields } from 'lib/checkout/processor-specific';
jest.mock( 'i18n-calypso', () => ( {
jest.mock( 'i18n-calypso', () => ( {
localize: x => x,
localize: x => x,
} ) );
} ) );
jest.mock( 'lib/checkout/processor-specific', () => {
jest.mock( 'lib/checkout/processor-specific', () => {
return {
return {
shouldRenderAdditionalCountryFields: jest.fn( false ),
shouldRenderAdditionalCountryFields: jest.fn( false ),
};
};
} );
} );
// Gets rid of warnings such as 'UnhandledPromiseRejectionWarning: Error: No available storage method found.'
// Gets rid of warnings such as 'UnhandledPromiseRejectionWarning: Error: No available storage method found.'
jest.mock( 'lib/user', () => () => {} );
jest.mock( 'lib/user', () => () => {} );
const defaultProps = {
const defaultProps = {
card: {},
card: {},
countriesList: [],
countriesList: [],
eventFormName: 'A fine form',
eventFormName: 'A fine form',
translate: identity,
translate: identity,
isFieldInvalid: identity,
isFieldInvalid: identity,
onFieldChange: noop,
onFieldChange: noop,
isNewTransaction: true,
isNewTransaction: true,
};
};
복사
복사됨
복사
복사됨
describe( 'CreditCardFormFields
', () => {
describe( 'CreditCardFormFields
UX
', () => {
test( 'should have `CreditCardFormFields
` class', () => {
test( 'should have `CreditCardFormFields
UX
` class', () => {
const wrapper = shallow( <CreditCardFormFields
{ ...defaultProps } /> );
const wrapper = shallow( <CreditCardFormFields
UX
{ ...defaultProps } /> );
expect( wrapper.find( '.credit-card-form-fields' ) ).toHaveLength( 1 );
expect( wrapper.find( '.credit-card-form-fields' ) ).toHaveLength( 1 );
} );
} );
test( 'should not render ebanx fields', () => {
test( 'should not render ebanx fields', () => {
복사
복사됨
복사
복사됨
const wrapper = shallow( <CreditCardFormFields
{ ...defaultProps } /> );
const wrapper = shallow( <CreditCardFormFields
UX
{ ...defaultProps } /> );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 );
} );
} );
describe( 'with ebanx activated', () => {
describe( 'with ebanx activated', () => {
beforeAll( () => {
beforeAll( () => {
shouldRenderAdditionalCountryFields.mockReturnValue( true );
shouldRenderAdditionalCountryFields.mockReturnValue( true );
} );
} );
afterAll( () => {
afterAll( () => {
shouldRenderAdditionalCountryFields.mockReturnValue( false );
shouldRenderAdditionalCountryFields.mockReturnValue( false );
} );
} );
test( 'should display Ebanx fields when an Ebanx payment country is selected and there is a transaction in process', () => {
test( 'should display Ebanx fields when an Ebanx payment country is selected and there is a transaction in process', () => {
복사
복사됨
복사
복사됨
const wrapper = shallow( <CreditCardFormFields
{ ...defaultProps } /> );
const wrapper = shallow( <CreditCardFormFields
UX
{ ...defaultProps } /> );
wrapper.setProps( { card: { country: 'BR' } } );
wrapper.setProps( { card: { country: 'BR' } } );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 1 );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 1 );
} );
} );
test( 'should not display Ebanx fields when there is a transaction in process', () => {
test( 'should not display Ebanx fields when there is a transaction in process', () => {
복사
복사됨
복사
복사됨
const wrapper = shallow( <CreditCardFormFields
{ ...defaultProps } /> );
const wrapper = shallow( <CreditCardFormFields
UX
{ ...defaultProps } /> );
wrapper.setProps( { card: { country: 'BR' }, isNewTransaction: false } );
wrapper.setProps( { card: { country: 'BR' }, isNewTransaction: false } );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 );
expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 );
} );
} );
} );
} );
} );
} );
저장된 비교 결과
원본
파일 열기
/** * @format * @jest-environment jsdom */ /** * External dependencies */ import { shallow } from 'enzyme'; import React from 'react'; import { identity, noop } from 'lodash'; /** * Internal dependencies */ import { CreditCardFormFields } from '../'; import { shouldRenderAdditionalCountryFields } from 'lib/checkout/processor-specific'; jest.mock( 'i18n-calypso', () => ( { localize: x => x, } ) ); jest.mock( 'lib/checkout/processor-specific', () => { return { shouldRenderAdditionalCountryFields: jest.fn( false ), }; } ); // Gets rid of warnings such as 'UnhandledPromiseRejectionWarning: Error: No available storage method found.' jest.mock( 'lib/user', () => () => {} ); const defaultProps = { card: {}, countriesList: [], eventFormName: 'A fine form', translate: identity, isFieldInvalid: identity, onFieldChange: noop, isNewTransaction: true, }; describe( 'CreditCardFormFields', () => { test( 'should have `CreditCardFormFields` class', () => { const wrapper = shallow( <CreditCardFormFields { ...defaultProps } /> ); expect( wrapper.find( '.credit-card-form-fields' ) ).toHaveLength( 1 ); } ); test( 'should not render ebanx fields', () => { const wrapper = shallow( <CreditCardFormFields { ...defaultProps } /> ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 ); } ); describe( 'with ebanx activated', () => { beforeAll( () => { shouldRenderAdditionalCountryFields.mockReturnValue( true ); } ); afterAll( () => { shouldRenderAdditionalCountryFields.mockReturnValue( false ); } ); test( 'should display Ebanx fields when an Ebanx payment country is selected and there is a transaction in process', () => { const wrapper = shallow( <CreditCardFormFields { ...defaultProps } /> ); wrapper.setProps( { card: { country: 'BR' } } ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 1 ); } ); test( 'should not display Ebanx fields when there is a transaction in process', () => { const wrapper = shallow( <CreditCardFormFields { ...defaultProps } /> ); wrapper.setProps( { card: { country: 'BR' }, isNewTransaction: false } ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 ); } ); } ); } );
수정본
파일 열기
/** * @format * @jest-environment jsdom */ /** * External dependencies */ import { shallow } from 'enzyme'; import React from 'react'; import { identity, noop } from 'lodash'; /** * Internal dependencies */ import { CreditCardFormFieldsUX } from '../'; import { shouldRenderAdditionalCountryFields } from 'lib/checkout/processor-specific'; jest.mock( 'i18n-calypso', () => ( { localize: x => x, } ) ); jest.mock( 'lib/checkout/processor-specific', () => { return { shouldRenderAdditionalCountryFields: jest.fn( false ), }; } ); // Gets rid of warnings such as 'UnhandledPromiseRejectionWarning: Error: No available storage method found.' jest.mock( 'lib/user', () => () => {} ); const defaultProps = { card: {}, countriesList: [], eventFormName: 'A fine form', translate: identity, isFieldInvalid: identity, onFieldChange: noop, isNewTransaction: true, }; describe( 'CreditCardFormFieldsUX', () => { test( 'should have `CreditCardFormFieldsUX` class', () => { const wrapper = shallow( <CreditCardFormFieldsUX { ...defaultProps } /> ); expect( wrapper.find( '.credit-card-form-fields' ) ).toHaveLength( 1 ); } ); test( 'should not render ebanx fields', () => { const wrapper = shallow( <CreditCardFormFieldsUX { ...defaultProps } /> ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 ); } ); describe( 'with ebanx activated', () => { beforeAll( () => { shouldRenderAdditionalCountryFields.mockReturnValue( true ); } ); afterAll( () => { shouldRenderAdditionalCountryFields.mockReturnValue( false ); } ); test( 'should display Ebanx fields when an Ebanx payment country is selected and there is a transaction in process', () => { const wrapper = shallow( <CreditCardFormFieldsUX { ...defaultProps } /> ); wrapper.setProps( { card: { country: 'BR' } } ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 1 ); } ); test( 'should not display Ebanx fields when there is a transaction in process', () => { const wrapper = shallow( <CreditCardFormFieldsUX { ...defaultProps } /> ); wrapper.setProps( { card: { country: 'BR' }, isNewTransaction: false } ); expect( wrapper.find( 'CountrySpecificPaymentFields' ) ).toHaveLength( 0 ); } ); } ); } );
비교하기