Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Commit

Permalink
Added test for Issue #15
Browse files Browse the repository at this point in the history
  • Loading branch information
GitBrent authored and GitBrent committed Feb 12, 2018
1 parent 0350ebd commit 6f393ff
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions test/qunit-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* NAME: qunit-test.js
* DESC: tests for qunit-test.html (coded to my O365 Dev Site - YMMV)
* AUTH: https://github.com/gitbrent/
* DATE: Dec 31, 2017
* DATE: Feb 11, 2018
*
* HOWTO: Generate text tables for README etc.:
* sprLib.list('Employees').getItems(['Id', 'Name', 'Badge_x0020_Number']).then(function(arrData){ console.log(getAsciiTableStr(arrData)) });
Expand Down Expand Up @@ -65,7 +65,6 @@ QUnit.module( "Library OPTIONS" );
// ================================================================================================
{
QUnit.test(`sprLib.baseUrl('${RESTROOT}')`, function(assert){
var done = assert.async();
// TEST:
// A: Set
sprLib.baseUrl(RESTROOT);
Expand All @@ -74,7 +73,6 @@ QUnit.module( "Library OPTIONS" );
// C: Test
assert.ok( strBaseUrl == RESTROOT, "Pass: `strBaseUrl == RESTROOT` Str: " + strBaseUrl );
//
done();
});
}

Expand Down Expand Up @@ -1052,6 +1050,24 @@ QUnit.module( "LIST > ITEM GET Methods" );
});
});

QUnit.test("sprLib.getItems() 20: `listCols` with duplicate column", function(assert){
var done = assert.async();
// TEST: This caused empty results until fixed in 1.5.0!
sprLib.list('Departments')
.getItems({ listCols:['Id','Id'] })
.then(function(arrayResults){
assert.ok( Object.keys(arrayResults[0]).length == 1, "arrayResults[0] has length == 1: "+ Object.keys(arrayResults[0]).length );
assert.ok( (arrayResults[0].Id) , "arrayResults[0].Id exists: "+ JSON.stringify(arrayResults[0].Id) );
assert.ok( getAsciiTableStr(arrayResults) , `RESULTS:\n${getAsciiTableStr(arrayResults)}`);
done();
})
.catch(function(errorMessage){
assert.ok( (false), errorMessage );
done();
});
});


QUnit.test("sprLib.getItems() 50: `queryNext` with return values", function(assert){
var done = assert.async();
var intLastID = 0;
Expand Down

0 comments on commit 6f393ff

Please sign in to comment.