File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 1
1
using { Currency , managed , sap } from ' @sap/cds/common' ;
2
2
namespace sap .capire .bookshop ;
3
3
4
+ @ odata . draft . enabled
4
5
entity Books : managed {
5
6
key ID : Integer ;
6
7
@ mandatory title : localized String(111) ;
Original file line number Diff line number Diff line change @@ -38,6 +38,15 @@ test.describe('tools', () => {
38
38
assert ( Array . isArray ( books [ 0 ] . endpoints ) , 'Should contain endpoints' )
39
39
assert . equal ( books [ 0 ] . endpoints [ 0 ] . kind , 'odata' , 'Should contain odata endpoint kind' )
40
40
assert . equal ( books [ 0 ] . endpoints [ 0 ] . path , 'odata/v4/admin/Books' , 'Should contain endpoint path' )
41
+
42
+ // Check that keys are present and correct
43
+ assert ( books [ 0 ] . elements . ID , 'Books entity should have key ID' )
44
+ assert ( books [ 0 ] . elements . ID . key === true , 'ID should be marked as key' )
45
+ // Check draft fields
46
+ assert ( books [ 0 ] . elements . IsActiveEntity , 'Draft-enabled entity should have IsActiveEntity' )
47
+ assert ( books [ 0 ] . elements . IsActiveEntity . key === true , 'IsActiveEntity should be marked as key' )
48
+ assert ( books [ 0 ] . elements . HasActiveEntity , 'Draft-enabled entity should have HasActiveEntity' )
49
+ assert ( books [ 0 ] . elements . HasDraftEntity , 'Draft-enabled entity should have HasDraftEntity' )
41
50
} )
42
51
43
52
test ( 'search_cds_definitions: should list all entities (namesOnly)' , async ( ) => {
You can’t perform that action at this time.
0 commit comments