Skip to content

Commit

Permalink
Add tests for computed elements
Browse files Browse the repository at this point in the history
  • Loading branch information
BobdenOs committed Aug 27, 2024
1 parent d885e9d commit 1e47b0b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/compliance/resources/db/complex/computed.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace complex.computed;

entity static {
value : Integer;
integer : Integer = 1;
double : Double = 0.1;
string : String = '';
}

entity dynamic {
integer : Integer;
@(Core.Computed: true,readonly)
![case] : String = (
case
when
integer = 0
then
'zero'
when
integer = 1
then
'one'
when
integer = 2
then
'two'
end
);
lambda : String = (integer = 0 ? 'none' : 'some')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = [
{
integer: 0,
'=case': 'zero',
'=lambda': 'none',
},
{
integer: 1,
'=case': 'one',
'=lambda': 'some',
},
{
integer: 2,
'=case': 'two',
'=lambda': 'some',
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = [
{
'=integer': 1,
'=double': 0.1,
'=string': '',
}
]
1 change: 1 addition & 0 deletions test/compliance/resources/db/complex/index.cds
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace complex;

using from './computed';
using from './associations';
using from './associationsUnmanaged';

0 comments on commit 1e47b0b

Please sign in to comment.