generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do Not Emit Elements That Are Part of
excluding
Clause (#118)
* Do not print elements specified via `excluding` keyword * Add test cases * Add changelog entry * Lint
- Loading branch information
Showing
4 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict' | ||
|
||
const fs = require('fs').promises | ||
const path = require('path') | ||
const cds2ts = require('../../lib/compile') | ||
const { ASTWrapper } = require('../ast') | ||
const { locations } = require('../util') | ||
const dir = locations.testOutput('excluding_test') | ||
|
||
describe('Excluding Clause', () => { | ||
let paths | ||
|
||
beforeEach(async () => await fs.unlink(dir).catch(() => {})) | ||
beforeAll(async () => { | ||
paths = await cds2ts | ||
.compileFromFile(locations.unit.files('excluding/model.cds'), { outputDirectory: dir }) | ||
}) | ||
|
||
test('Element Present in Original', async () => | ||
expect(new ASTWrapper(path.join(paths[1], 'index.ts')).exists('_TestObjectAspect', 'dependencies')).toBeTruthy()) | ||
|
||
test('Element Gone in Projection', async () => | ||
expect(new ASTWrapper(path.join(paths[2], 'index.ts')) | ||
.getAspect('_SlimTestObjectAspect') | ||
.members | ||
.find(({name}) => name === 'dependencies') | ||
).toBeFalsy()) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace excluding_test; | ||
|
||
entity Foo {} | ||
|
||
entity TestObjects { | ||
key ID: UUID; | ||
name: String not null; | ||
description: String; | ||
dependencies: Association to many Foo; | ||
} | ||
|
||
service TestService { | ||
entity SlimTestObjects as projection on TestObjects excluding { dependencies }; | ||
} |