Completed
Push — master ( 8b9cfc...42b0f8 )
by wiese
319:40 queued 254:38
created

skins/cat17/src/app/tests/state_aggregation/membership/test_all_validation_sections_are_valid.js   A

Complexity

Total Complexity 7
Complexity/F 1

Size

Lines of Code 117
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 7
c 1
b 0
f 0
nc 1
mnd 0
bc 7
fnc 7
dl 0
loc 117
rs 10
bpm 1
cpm 1
noi 0

7 Functions

Rating   Name   Duplication   Size   Complexity  
A test_all_validation_sections_are_valid.js ➔ test(ꞌSustaining membership payed by PPL with with invalid address is invalidꞌ) 0 15 1
A test_all_validation_sections_are_valid.js ➔ test(ꞌUnselected membership type is invalidꞌ) 0 15 1
A test_all_validation_sections_are_valid.js ➔ test(ꞌSustaining membership payed by PPL with invalid paymentData is invalidꞌ) 0 15 1
A test_all_validation_sections_are_valid.js ➔ test(ꞌSustaining membership payed by PPL with address, and payment info is valid without bank dataꞌ) 0 15 1
A test_all_validation_sections_are_valid.js ➔ test(ꞌActive membership payed by BEZ with sane bank data, address, and payment info is validꞌ) 0 15 1
A test_all_validation_sections_are_valid.js ➔ test(ꞌActive membership for company donors is invalidꞌ) 0 15 1
A test_all_validation_sections_are_valid.js ➔ test(ꞌActive membership payed by PPL with address, and payment info is valid without bank dataꞌ) 0 15 1
1
'use strict';
2
3
var test = require( 'tape-catch' ),
4
	allSectionsAreValid = require( '../../../lib/state_aggregation/membership/all_validation_sections_are_valid.js' )
5
;
6
7
test( 'Unselected membership type is invalid', function ( t ) {
8
	t.notOk( allSectionsAreValid( {
9
		membershipFormContent: {
10
			addressType: 'person',
11
			membershipType: null,
12
			paymentType: 'PPL'
13
		},
14
		validity: {
15
			paymentData: true,
16
			address: true,
17
			bankData: null
18
		}
19
	} ) );
20
	t.end();
21
} );
22
23
test( 'Active membership payed by BEZ with sane bank data, address, and payment info is valid', function ( t ) {
24
	t.ok( allSectionsAreValid( {
25
		membershipFormContent: {
26
			addressType: 'person',
27
			membershipType: 'active',
28
			paymentType: 'BEZ'
29
		},
30
		validity: {
31
			paymentData: true,
32
			address: true,
33
			bankData: true
34
		}
35
	} ) );
36
	t.end();
37
} );
38
39
test( 'Active membership payed by PPL with address, and payment info is valid without bank data', function ( t ) {
40
	t.ok( allSectionsAreValid( {
41
		membershipFormContent: {
42
			addressType: 'person',
43
			membershipType: 'active',
44
			paymentType: 'PPL'
45
		},
46
		validity: {
47
			paymentData: true,
48
			address: true,
49
			bankData: null
50
		}
51
	} ) );
52
	t.end();
53
} );
54
55
test( 'Sustaining membership payed by PPL with address, and payment info is valid without bank data', function ( t ) {
56
	t.ok( allSectionsAreValid( {
57
		membershipFormContent: {
58
			addressType: 'firma',
59
			membershipType: 'sustaining',
60
			paymentType: 'PPL'
61
		},
62
		validity: {
63
			paymentData: true,
64
			address: true,
65
			bankData: null
66
		}
67
	} ) );
68
	t.end();
69
} );
70
71
test( 'Sustaining membership payed by PPL with with invalid address is invalid', function ( t ) {
72
	t.notOk( allSectionsAreValid( {
73
		membershipFormContent: {
74
			addressType: 'person',
75
			membershipType: 'sustaining',
76
			paymentType: 'PPL'
77
		},
78
		validity: {
79
			paymentData: true,
80
			address: false,
81
			bankData: null
82
		}
83
	} ) );
84
	t.end();
85
} );
86
87
test( 'Sustaining membership payed by PPL with invalid paymentData is invalid', function ( t ) {
88
	t.notOk( allSectionsAreValid( {
89
		membershipFormContent: {
90
			addressType: 'person',
91
			membershipType: 'sustaining',
92
			paymentType: 'PPL'
93
		},
94
		validity: {
95
			paymentData: false,
96
			address: true,
97
			bankData: null
98
		}
99
	} ) );
100
	t.end();
101
} );
102
103
test( 'Active membership for company donors is invalid', function ( t ) {
104
	t.notOk( allSectionsAreValid( {
105
		membershipFormContent: {
106
			addressType: 'firma',
107
			membershipType: 'active',
108
			paymentType: 'PPL'
109
		},
110
		validity: {
111
			paymentData: true,
112
			address: true,
113
			bankData: null
114
		}
115
	} ) );
116
	t.end();
117
} );
118
119