[new] Test Cases Added for Non Profit

This commit is contained in:
Vishal 2017-10-05 16:20:23 +05:30
parent 86140c8659
commit 5cd70bed25
11 changed files with 68 additions and 28 deletions

View File

@ -6,16 +6,20 @@ QUnit.test("test: Donor", function (assert) {
let done = assert.async(); let done = assert.async();
// number of asserts // number of asserts
assert.expect(1); assert.expect(3);
frappe.run_serially([ frappe.run_serially([
// insert a new Donor // insert a new Member
() => frappe.tests.make('Donor', [ () => frappe.tests.make('Donor', [
// values to be set // values to be set
{key: 'value'} {donor_name: 'Test Donor'},
{donor_type: 'Test Organization'},
{email: 'test@example.com'}
]), ]),
() => { () => {
assert.equal(cur_frm.doc.key, 'value'); assert.equal(cur_frm.doc.donor_name, 'Test Donor');
assert.equal(cur_frm.doc.donor_type, 'Test Organization');
assert.equal(cur_frm.doc.email, 'test@example.com');
}, },
() => done() () => done()
]); ]);

View File

@ -3,7 +3,7 @@
"allow_guest_to_view": 0, "allow_guest_to_view": 0,
"allow_import": 0, "allow_import": 0,
"allow_rename": 0, "allow_rename": 0,
"autoname": "field:volunteer_type", "autoname": "field:donor_type",
"beta": 0, "beta": 0,
"creation": "2017-09-19 16:19:16.639635", "creation": "2017-09-19 16:19:16.639635",
"custom": 0, "custom": 0,
@ -19,7 +19,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"fieldname": "volunteer_type", "fieldname": "donor_type",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
@ -54,7 +54,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-09-19 16:19:16.639635", "modified": "2017-10-05 16:00:57.751338",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Non Profit", "module": "Non Profit",
"name": "Donor Type", "name": "Donor Type",

View File

@ -9,13 +9,13 @@ QUnit.test("test: Donor Type", function (assert) {
assert.expect(1); assert.expect(1);
frappe.run_serially([ frappe.run_serially([
// insert a new Donor Type // insert a new Member
() => frappe.tests.make('Donor Type', [ () => frappe.tests.make('Donor Type', [
// values to be set // values to be set
{key: 'value'} {donor_type: 'Test Organization'},
]), ]),
() => { () => {
assert.equal(cur_frm.doc.key, 'value'); assert.equal(cur_frm.doc.donor_type, 'Test Organization');
}, },
() => done() () => done()
]); ]);

View File

@ -1,3 +1,3 @@
frappe.listview_settings['Grant Application'] = { frappe.listview_settings['Grant Application'] = {
add_fields: ["grant_application_name", "image"], add_fields: ["grant_applicant_name", "image"],
}; };

View File

@ -6,16 +6,25 @@ QUnit.test("test: Grant Application", function (assert) {
let done = assert.async(); let done = assert.async();
// number of asserts // number of asserts
assert.expect(1); assert.expect(4);
frappe.run_serially([ frappe.run_serially([
// insert a new Grant Application // insert a new Member
() => frappe.tests.make('Grant Application', [ () => frappe.tests.make('Grant Application', [
// values to be set // values to be set
{key: 'value'} {organization: 'Test Organization'},
{grant_applicant_name:'Test Applicant'},
{email: 'test@example.com'},
{grant_description:'Test message'},
{grant_purpose: 'Test Meesage'},
{amount: 150000},
{grant_past_record:'NO'}
]), ]),
() => { () => {
assert.equal(cur_frm.doc.key, 'value'); assert.equal(cur_frm.doc.organization, 'Test Organization');
assert.equal(cur_frm.doc.grant_applicant_name, 'Test Applicant');
assert.equal(cur_frm.doc.email, 'test@example.com');
assert.equal(cur_frm.doc.amount, 150000);
}, },
() => done() () => done()
]); ]);

View File

@ -386,7 +386,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-09-22 13:03:06.022229", "modified": "2017-10-05 14:42:21.421863",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Non Profit", "module": "Non Profit",
"name": "Member", "name": "Member",

View File

@ -1,3 +1,3 @@
frappe.listview_settings['Member'] = { frappe.listview_settings['Member'] = {
add_fields: ["member_name", "member_type", "image"], add_fields: ["member_name", "membership_type", "image"],
}; };

View File

@ -6,16 +6,19 @@ QUnit.test("test: Member", function (assert) {
let done = assert.async(); let done = assert.async();
// number of asserts // number of asserts
assert.expect(1); assert.expect(2);
frappe.run_serially([ frappe.run_serially([
// insert a new Member // insert a new Member
() => frappe.tests.make('Member', [ () => frappe.tests.make('Member', [
// values to be set // values to be set
{key: 'value'} {member_name: 'Test Member'},
{membership_type: 'Gold'},
{email: 'test@example.com'}
]), ]),
() => { () => {
assert.equal(cur_frm.doc.key, 'value'); assert.equal(cur_frm.doc.membership_type, 'Gold');
assert.equal(cur_frm.doc.email, 'test@example.com');
}, },
() => done() () => done()
]); ]);

View File

@ -6,16 +6,31 @@ QUnit.test("test: Volunteer", function (assert) {
let done = assert.async(); let done = assert.async();
// number of asserts // number of asserts
assert.expect(1); assert.expect(4);
frappe.run_serially([ frappe.run_serially([
// insert a new Volunteer // insert a new Member
() => frappe.tests.make('Volunteer', [ () => frappe.tests.make('Volunteer', [
// values to be set // values to be set
{key: 'value'} {volunteer_name: 'Test Volunteer'},
{volunteer_type:'Test Work'},
{email:'test@example.com'},
{volunteer_availability_table:[
[
{'volunteer_availability': 'Weekends'},
]
]},
{volunteer_skills_table:[
[
{'volunteer_skills': 'Fundraiser'},
]
]},
]), ]),
() => { () => {
assert.equal(cur_frm.doc.key, 'value'); assert.equal(cur_frm.doc.volunteer_name, 'Test Volunteer');
assert.equal(cur_frm.doc.volunteer_type, 'Test Work');
assert.equal(cur_frm.doc.email, 'test@example.com');
assert.equal(cur_frm.doc.volunteer_availability_table[0].volunteer_availability, 'Weekends');
}, },
() => done() () => done()
]); ]);

View File

@ -6,16 +6,18 @@ QUnit.test("test: Volunteer Type", function (assert) {
let done = assert.async(); let done = assert.async();
// number of asserts // number of asserts
assert.expect(1); assert.expect(2);
frappe.run_serially([ frappe.run_serially([
// insert a new Volunteer Type // insert a new Member
() => frappe.tests.make('Volunteer Type', [ () => frappe.tests.make('Volunteer Type', [
// values to be set // values to be set
{key: 'value'} {volunteer_type: 'Test Work'},
{amount: 500}
]), ]),
() => { () => {
assert.equal(cur_frm.doc.key, 'value'); assert.equal(cur_frm.doc.volunteer_type, 'Test Work');
assert.equal(cur_frm.doc.amount, 500);
}, },
() => done() () => done()
]); ]);

View File

@ -140,3 +140,10 @@ erpnext/stock/doctype/delivery_note/test_delivery_note_with_margin.js
erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js erpnext/selling/doctype/sales_order/tests/test_sales_order_with_margin.js
erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js erpnext/selling/doctype/quotation/tests/test_quotation_with_margin.js
erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js erpnext/accounts/doctype/sales_invoice/tests/test_sales_invoice_with_margin.js
erpnext/non_profit/doctype/membership_type/test_member.js
erpnext/non_profit/doctype/member/test_member.js
erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.js
erpnext/non_profit/doctype/volunteer/test_volunteer.js
erpnext/non_profit/doctype/donor_type/test_donor_type.js
erpnext/non_profit/doctype/donor/test_donor.js
erpnext/non_profit/doctype/grant_application/test_grant_application.js