Skip to content

Commit

Permalink
Add negative test case for appending more elements than max allowed i…
Browse files Browse the repository at this point in the history
…n a DB Collection object
  • Loading branch information
sharadraju committed Dec 21, 2024
1 parent d222945 commit 88db945
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
17 changes: 12 additions & 5 deletions test/dbObject15.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('214. dbObject15.js', () => {
await conn.execute(plsql);

plsql = `
CREATE OR REPLACE TYPE ${TEAM_T} AS VARRAY(10) OF ${PLAYER_T};
CREATE OR REPLACE TYPE ${TEAM_T} AS VARRAY(5) OF ${PLAYER_T};
`;
await conn.execute(plsql);

Expand Down Expand Up @@ -102,20 +102,27 @@ describe('214. dbObject15.js', () => {
}
}); // 214.2

it('214.3 Negative - delete the collection element directly', function() {
it('214.3 Negative - cannot add more than maximum number of elements', function() {
assert.throws(
() => FrisbeeTeam.append({SHIRTNUMBER: 9, NAME: 'Diogo'}),
/NJS-131:/
);
}); // 214.3

it('214.4 Negative - Cannot delete the VARRAY collection element directly', function() {
assert.throws(
() => delete FrisbeeTeam[1],
/NJS-133:/
);
}); // 214.3
}); // 214.4

it('214.4 Negative - collection.deleteElement()', function() {
it('214.5 Negative - collection.deleteElement()', function() {
assert.throws(
function() {
const firstIndex = FrisbeeTeam.getFirstIndex();
FrisbeeTeam.deleteElement(firstIndex);
},
/NJS-133:/
);
}); // 214.4
}); // 214.5
});
5 changes: 3 additions & 2 deletions test/list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4721,8 +4721,9 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
214. dbObject15.js
214.1 Getter() - access collection elements directly
214.2 Setter() - access collection element directly
214.3 Negative - delete the collection element directly
214.4 Negative - collection.deleteElement()
214.3 Negative - cannot add more than maximum number of elements
214.4 Negative - delete the collection element directly
214.5 Negative - collection.deleteElement()

215. dbObject16.js
215.1 Collection of DATE, named Oracle type binds
Expand Down

0 comments on commit 88db945

Please sign in to comment.