Skip to content

Commit 88db945

Browse files
committed
Add negative test case for appending more elements than max allowed in a DB Collection object
1 parent d222945 commit 88db945

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

test/dbObject15.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('214. dbObject15.js', () => {
6262
await conn.execute(plsql);
6363

6464
plsql = `
65-
CREATE OR REPLACE TYPE ${TEAM_T} AS VARRAY(10) OF ${PLAYER_T};
65+
CREATE OR REPLACE TYPE ${TEAM_T} AS VARRAY(5) OF ${PLAYER_T};
6666
`;
6767
await conn.execute(plsql);
6868

@@ -102,20 +102,27 @@ describe('214. dbObject15.js', () => {
102102
}
103103
}); // 214.2
104104

105-
it('214.3 Negative - delete the collection element directly', function() {
105+
it('214.3 Negative - cannot add more than maximum number of elements', function() {
106+
assert.throws(
107+
() => FrisbeeTeam.append({SHIRTNUMBER: 9, NAME: 'Diogo'}),
108+
/NJS-131:/
109+
);
110+
}); // 214.3
111+
112+
it('214.4 Negative - Cannot delete the VARRAY collection element directly', function() {
106113
assert.throws(
107114
() => delete FrisbeeTeam[1],
108115
/NJS-133:/
109116
);
110-
}); // 214.3
117+
}); // 214.4
111118

112-
it('214.4 Negative - collection.deleteElement()', function() {
119+
it('214.5 Negative - collection.deleteElement()', function() {
113120
assert.throws(
114121
function() {
115122
const firstIndex = FrisbeeTeam.getFirstIndex();
116123
FrisbeeTeam.deleteElement(firstIndex);
117124
},
118125
/NJS-133:/
119126
);
120-
}); // 214.4
127+
}); // 214.5
121128
});

test/list.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -4721,8 +4721,9 @@ oracledb.OUT_FORMAT_OBJECT and resultSet = true
47214721
214. dbObject15.js
47224722
214.1 Getter() - access collection elements directly
47234723
214.2 Setter() - access collection element directly
4724-
214.3 Negative - delete the collection element directly
4725-
214.4 Negative - collection.deleteElement()
4724+
214.3 Negative - cannot add more than maximum number of elements
4725+
214.4 Negative - delete the collection element directly
4726+
214.5 Negative - collection.deleteElement()
47264727

47274728
215. dbObject16.js
47284729
215.1 Collection of DATE, named Oracle type binds

0 commit comments

Comments
 (0)