Skip to content

Commit

Permalink
fix: TODOs in Deprecated.js (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
abmusse committed Apr 17, 2020
1 parent 29bc850 commit cd47476
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 51 deletions.
29 changes: 8 additions & 21 deletions lib/Deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,6 @@ class iNetwork {
DNS_listening_port: data[27]._,
Host_name: data[28]._,
Domain_name: data[29]._,
Reserved: data[30]._,
Domain_search_list: data[31]._,
};
} else { rtValue = str; }
Expand Down Expand Up @@ -1217,17 +1216,13 @@ class iObj {
Adopted_data_update: data[21]._,
Adopted_data_delete: data[22]._,
Adopted_data_execute: data[23]._,
Reserved: data[24]._,
Adopted_object_alter: data[25]._,
Adopted_object_reference: data[26]._,
// Reserved: data[27]._, // TODO: duplicate key
Data_execute: data[28]._,
// Reserved: data[29]._, // TODO: duplicate key
Object_alter: data[30]._,
Object_reference: data[31]._,
ASP_device_name_of_library: data[32]._,
ASP_device_name_of_object: data[33]._,
// Reserved: data[34]._, // TODO: duplicate key
Offset_to_group_information_table: data[35]._,
Number_of_group_table_entries_returned: data[36]._,
};
Expand Down Expand Up @@ -1530,7 +1525,6 @@ class iObj {
Text_description: data[17]._,
Type_of_program: data[18]._,
'Teraspace_storage-enabled_program': data[19]._,
Reserved: data[20]._,
Minimum_number_of_parameters: data[21]._,
Maximum_number_of_parameters: data[22]._,
Program_size: data[23]._,
Expand All @@ -1548,13 +1542,11 @@ class iObj {
Program_domain: data[35]._,
Conversion_required: data[36]._,
Conversion_details: data[37]._,
// Reserved: data[38]._, // TODO: duplicate
Optimization: data[39]._,
Paging_pool: data[40]._,
'Update_program_automatic_storage_area_(PASA)': data[41]._,
'Clear_program_automatic_storage_area_(PASA)': data[42]._,
Paging_amount: data[43]._,
// Reserved: data[38]._, // TODO: duplicate
Program_entry_procedure_module: data[45]._,
Program_entry_procedure_module_library: data[46]._,
Activation_group_attribute: data[47]._,
Expand Down Expand Up @@ -1715,7 +1707,6 @@ class iObj {
Teraspace_storage_enabled_modules: data[26]._,
Storage_model: data[27]._,
'Uses_argument_optimization_(ARGOPT)': data[28]._,
"Reserved_'00'X": data[29]._,
Service_program_state: data[30]._,
Service_program_domain: data[31]._,
Associated_space_size: data[32]._,
Expand All @@ -1728,7 +1719,6 @@ class iObj {
Conversion_required: data[39]._,
All_creation_data: data[40]._,
Conversion_details: data[41]._,
Reserved: data[42]._,
Paging_pool: data[43]._,
Paging_amount: data[44]._,
};
Expand Down Expand Up @@ -1808,12 +1798,10 @@ class iObj {
rtValue = {
User_profile_name: data[2]._,
'Previous_sign-on_date_and_time': data[3]._,
// Reserved: data[4]._, // TODO: This is a duplicate
'Sign-on_attempts_not_valid': data[5]._,
Status: data[6]._,
Password_change_date: data[7]._,
No_password_indicator: data[8]._,
Reserved: data[9]._,
Password_expiration_interval: data[10]._,
Date_password_expires: data[11]._,
Days_until_password_expires: data[12]._,
Expand Down Expand Up @@ -1924,7 +1912,6 @@ class iObj {
Object_existence: data[5]._,
Object_alter: data[6]._,
Object_reference: data[7]._,
Reserved: data[8]._,
Object_operational: data[9]._,
Data_read: data[10]._,
Data_add: data[11]._,
Expand Down Expand Up @@ -2116,7 +2103,6 @@ class iProd {
Server_IPL_required: data[29]._,
Creation_date_and_time: data[30]._,
Technology_refresh_PTF: data[31]._,
Reserved: data[32]._,
};
} else { rtValue = str; }

Expand Down Expand Up @@ -2232,7 +2218,6 @@ class iProd {
const { data } = result.myscript.pgm[0].parm[0].ds[0];

rtValue = {
// Reserved: data[2]._, // TODO: Duplicate key
Product_ID: data[3]._,
Release_level: data[4]._,
Product_option: data[5]._,
Expand All @@ -2244,14 +2229,12 @@ class iProd {
Supported_flag: data[11]._,
Registration_type: data[12]._,
Registration_value: data[13]._,
// Reserved: data[14]._, // TODO: Duplicate key
Offset_to_additional_information: data[15]._,
Primary_language_load_identifier: data[16]._,
Minimum_target_release: data[17]._,
'Minimum_VRM_of_*BASE_required_by_option': data[18]._,
Requirements_met_between_base_and_option_value: data[19]._,
Level: data[20]._,
Reserved: data[21]._,
};
} else { rtValue = str; }

Expand Down Expand Up @@ -2767,8 +2750,14 @@ class iWork {
return false;
}));

// TODO: Throw error
if (keyValid === false) { return; }
if (keyValid === false) {
if (this.reportError) {
cb(new Error(`Invalid System value: ${sysValue}`), null);
return;
}
cb(null);
return;
}

let item;
if (type === '10i0') { item = { type: '10i0', value: 0 }; } else { item = { type, value: '' }; }
Expand Down Expand Up @@ -3398,8 +3387,6 @@ const xmlToJson = (xml) => {
const rtDataRegG = /<data desc='.*?'>[\s\S]*?<\/data>/g;
const rtDataReg = /<data desc='(.*?)'>([\s\S]*?)<\/data>/;

// const dsRegG = /<ds.*?>[\s\S]+?<\/ds>/g; // TODO: Not used
// const dsReg = /<ds.*?>([\s\S]+?)<\/ds>/; // TODO: Not used
const dataRegG = /<data[\s\S]*?<\/data>/g;
const dataReg = /<data.*?type='(.*?)'.*?>([\s\S]*?)<\/data>/;
const sqlResultG = /<row>[\s\S]+?<\/row>/g;
Expand Down
1 change: 0 additions & 1 deletion test/functional/deprecated/iNetworkFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ describe('iNetwork Functional Tests', () => {
expect(output).to.have.a.property('DNS_listening_port');
expect(output).to.have.a.property('Host_name');
expect(output).to.have.a.property('Domain_name');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Domain_search_list');
done();
});
Expand Down
12 changes: 0 additions & 12 deletions test/functional/deprecated/iObjFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,13 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Adopted_data_update');
expect(output).to.have.a.property('Adopted_data_delete');
expect(output).to.have.a.property('Adopted_data_execute');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Adopted_object_alter');
expect(output).to.have.a.property('Adopted_object_reference');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Data_execute');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Object_alter');
expect(output).to.have.a.property('Object_reference');
expect(output).to.have.a.property('ASP_device_name_of_library');
expect(output).to.have.a.property('ASP_device_name_of_object');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Offset_to_group_information_table');
expect(output).to.have.a.property('Number_of_group_table_entries_returned');
done();
Expand Down Expand Up @@ -182,7 +178,6 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Text_description');
expect(output).to.have.a.property('Type_of_program');
expect(output).to.have.a.property('Teraspace_storage-enabled_program');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Minimum_number_of_parameters');
expect(output).to.have.a.property('Maximum_number_of_parameters');
expect(output).to.have.a.property('Program_size');
Expand All @@ -200,13 +195,11 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Program_domain');
expect(output).to.have.a.property('Conversion_required');
expect(output).to.have.a.property('Conversion_details');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Optimization');
expect(output).to.have.a.property('Paging_pool');
expect(output).to.have.a.property('Update_program_automatic_storage_area_(PASA)');
expect(output).to.have.a.property('Clear_program_automatic_storage_area_(PASA)');
expect(output).to.have.a.property('Paging_amount');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Program_entry_procedure_module');
expect(output).to.have.a.property('Program_entry_procedure_module_library');
expect(output).to.have.a.property('Activation_group_attribute');
Expand Down Expand Up @@ -269,7 +262,6 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Teraspace_storage_enabled_modules');
expect(output).to.have.a.property('Storage_model');
expect(output).to.have.a.property('Uses_argument_optimization_(ARGOPT)');
expect(output).to.have.a.property('Reserved_\'00\'X');
expect(output).to.have.a.property('Service_program_state');
expect(output).to.have.a.property('Service_program_domain');
expect(output).to.have.a.property('Associated_space_size');
Expand All @@ -282,7 +274,6 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Conversion_required');
expect(output).to.have.a.property('All_creation_data');
expect(output).to.have.a.property('Conversion_details');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Paging_pool');
expect(output).to.have.a.property('Paging_amount');
done();
Expand All @@ -300,12 +291,10 @@ describe('iObj Functional Tests', () => {
expect(output).to.be.an('Object');
expect(output).to.have.a.property('User_profile_name');
expect(output).to.have.a.property('Previous_sign-on_date_and_time');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Sign-on_attempts_not_valid');
expect(output).to.have.a.property('Status');
expect(output).to.have.a.property('Password_change_date');
expect(output).to.have.a.property('No_password_indicator');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Password_expiration_interval');
expect(output).to.have.a.property('Date_password_expires');
expect(output).to.have.a.property('Days_until_password_expires');
Expand Down Expand Up @@ -334,7 +323,6 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Object_existence');
expect(output).to.have.a.property('Object_alter');
expect(output).to.have.a.property('Object_reference');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Object_operational');
expect(output).to.have.a.property('Data_read');
expect(output).to.have.a.property('Data_add');
Expand Down
2 changes: 0 additions & 2 deletions test/functional/deprecated/iProdFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ describe('iProd Functional Tests', () => {
expect(ptf).to.have.a.property('Server_IPL_required');
expect(ptf).to.have.a.property('Creation_date_and_time');
expect(ptf).to.have.a.property('Technology_refresh_PTF');
expect(ptf).to.have.a.property('Reserved');
done();
});
});
Expand All @@ -107,7 +106,6 @@ describe('iProd Functional Tests', () => {

prod.getProductInfo('5770DG1', (product) => {
expect(product).to.be.an('Object');
expect(product).to.have.a.property('Reserved');
expect(product).to.have.a.property('Product_ID');
expect(product).to.have.a.property('Release_level');
expect(product).to.have.a.property('Product_option');
Expand Down
1 change: 0 additions & 1 deletion test/functional/iNetworkFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe('iNetwork Functional Tests', () => {
expect(output).to.have.a.property('DNS_listening_port');
expect(output).to.have.a.property('Host_name');
expect(output).to.have.a.property('Domain_name');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Domain_search_list');
done();
});
Expand Down
12 changes: 0 additions & 12 deletions test/functional/iObjFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,13 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Adopted_data_update');
expect(output).to.have.a.property('Adopted_data_delete');
expect(output).to.have.a.property('Adopted_data_execute');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Adopted_object_alter');
expect(output).to.have.a.property('Adopted_object_reference');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Data_execute');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Object_alter');
expect(output).to.have.a.property('Object_reference');
expect(output).to.have.a.property('ASP_device_name_of_library');
expect(output).to.have.a.property('ASP_device_name_of_object');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Offset_to_group_information_table');
expect(output).to.have.a.property('Number_of_group_table_entries_returned');
done();
Expand Down Expand Up @@ -156,7 +152,6 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Text_description');
expect(output).to.have.a.property('Type_of_program');
expect(output).to.have.a.property('Teraspace_storage-enabled_program');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Minimum_number_of_parameters');
expect(output).to.have.a.property('Maximum_number_of_parameters');
expect(output).to.have.a.property('Program_size');
Expand All @@ -174,13 +169,11 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Program_domain');
expect(output).to.have.a.property('Conversion_required');
expect(output).to.have.a.property('Conversion_details');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Optimization');
expect(output).to.have.a.property('Paging_pool');
expect(output).to.have.a.property('Update_program_automatic_storage_area_(PASA)');
expect(output).to.have.a.property('Clear_program_automatic_storage_area_(PASA)');
expect(output).to.have.a.property('Paging_amount');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Program_entry_procedure_module');
expect(output).to.have.a.property('Program_entry_procedure_module_library');
expect(output).to.have.a.property('Activation_group_attribute');
Expand Down Expand Up @@ -244,7 +237,6 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Teraspace_storage_enabled_modules');
expect(output).to.have.a.property('Storage_model');
expect(output).to.have.a.property('Uses_argument_optimization_(ARGOPT)');
expect(output).to.have.a.property('Reserved_\'00\'X');
expect(output).to.have.a.property('Service_program_state');
expect(output).to.have.a.property('Service_program_domain');
expect(output).to.have.a.property('Associated_space_size');
Expand All @@ -257,7 +249,6 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Conversion_required');
expect(output).to.have.a.property('All_creation_data');
expect(output).to.have.a.property('Conversion_details');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Paging_pool');
expect(output).to.have.a.property('Paging_amount');
done();
Expand All @@ -276,12 +267,10 @@ describe('iObj Functional Tests', () => {
expect(output).to.be.an('Object');
expect(output).to.have.a.property('User_profile_name');
expect(output).to.have.a.property('Previous_sign-on_date_and_time');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Sign-on_attempts_not_valid');
expect(output).to.have.a.property('Status');
expect(output).to.have.a.property('Password_change_date');
expect(output).to.have.a.property('No_password_indicator');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Password_expiration_interval');
expect(output).to.have.a.property('Date_password_expires');
expect(output).to.have.a.property('Days_until_password_expires');
Expand Down Expand Up @@ -311,7 +300,6 @@ describe('iObj Functional Tests', () => {
expect(output).to.have.a.property('Object_existence');
expect(output).to.have.a.property('Object_alter');
expect(output).to.have.a.property('Object_reference');
expect(output).to.have.a.property('Reserved');
expect(output).to.have.a.property('Object_operational');
expect(output).to.have.a.property('Data_read');
expect(output).to.have.a.property('Data_add');
Expand Down
2 changes: 0 additions & 2 deletions test/functional/iProdFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe('iProd Functional Tests', () => {
expect(ptf).to.have.a.property('Server_IPL_required');
expect(ptf).to.have.a.property('Creation_date_and_time');
expect(ptf).to.have.a.property('Technology_refresh_PTF');
expect(ptf).to.have.a.property('Reserved');
done();
});
});
Expand All @@ -80,7 +79,6 @@ describe('iProd Functional Tests', () => {
prod.getProductInfo('5770DG1', (error, product) => {
expect(error).to.equal(null);
expect(product).to.be.an('Object');
expect(product).to.have.a.property('Reserved');
expect(product).to.have.a.property('Product_ID');
expect(product).to.have.a.property('Release_level');
expect(product).to.have.a.property('Product_option');
Expand Down
11 changes: 11 additions & 0 deletions test/functional/iWorkFunctional.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ describe('iWork Functional Tests', () => {
done();
});
});

it('returns an error when the specified system value is invalid', (done) => {
const connection = new Connection(config);

const work = new iWork(connection);

work.getSysValue('invalid', (error) => {
expect(error).to.be.a('error');
done();
});
});
});

describe('getSysStatus', () => {
Expand Down

0 comments on commit cd47476

Please sign in to comment.