generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/namespace-enums
- Loading branch information
Showing
6 changed files
with
83 additions
and
7 deletions.
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
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,14 @@ | ||
namespace scoped; | ||
|
||
entity Name.Something { | ||
key something: String; | ||
} | ||
|
||
entity Name.SomethingElse { | ||
key something: String; | ||
} | ||
|
||
entity Name { | ||
key something: String; | ||
somethingElse: Association to Name.SomethingElse | ||
} |
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,30 @@ | ||
'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('scoped_test') | ||
|
||
describe('Scoped Entities', () => { | ||
let astw | ||
|
||
beforeEach(async () => await fs.unlink(dir).catch(() => {})) | ||
beforeAll(async () => { | ||
const paths = await cds2ts | ||
.compileFromFile(locations.unit.files('scoped/model.cds'), { outputDirectory: dir, inlineDeclarations: 'structured' }) | ||
astw = new ASTWrapper(path.join(paths[1], 'index.ts')) | ||
}) | ||
|
||
test('Namespace Exists', () => expect(astw.getModuleDeclaration('Name')).toBeTruthy()) | ||
test('Namespace Entity Exists', () => expect(astw.getAspect('_NameAspect')).toBeTruthy()) | ||
|
||
test('Entities Present Within Namespace', () => { | ||
const namespace = astw.getModuleDeclaration('Name') | ||
expect(namespace).toBeTruthy() | ||
expect(namespace.body.find(e => e.name === 'Something')).toBeTruthy() | ||
expect(namespace.body.find(e => e.name === 'Something_')).toBeTruthy() | ||
}) | ||
}) |