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.
* Cleanup tests * Fix output test
- Loading branch information
Showing
21 changed files
with
186 additions
and
406 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
'use strict' | ||
|
||
const fs = require('fs').promises | ||
const path = require('path') | ||
const { ASTWrapper } = require('../ast') | ||
const { locations, cds2ts } = require('../util') | ||
|
||
const dir = locations.testOutput('autoexpose_test') | ||
const { locations, prepareUnitTest } = require('../util') | ||
|
||
describe('Autoexpose', () => { | ||
beforeEach(async () => await fs.unlink(dir).catch(() => {})) | ||
let ast | ||
|
||
beforeAll(async () => ast = (await prepareUnitTest('autoexpose/service.cds', locations.testOutput('autoexpose_test'))).astw.tree) | ||
|
||
test('Autoexposed Composition Target Present in Service', async () => { | ||
const paths = await cds2ts('autoexpose/service.cds', { outputDirectory: dir, inlineDeclarations: 'structured' }) | ||
const ast = new ASTWrapper(path.join(paths[1], 'index.ts')).tree | ||
expect(ast.find(n => n.name === 'Books')).toBeTruthy() | ||
}) | ||
test('Autoexposed Composition Target Present in Service', async () => expect(ast.find(n => n.name === 'Books')).toBeTruthy()) | ||
}) |
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
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 |
---|---|---|
@@ -1,35 +1,24 @@ | ||
'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('foreign_keys') | ||
const { locations, prepareUnitTest } = require('../util') | ||
|
||
describe('Foreign Keys', () => { | ||
let ast | ||
beforeEach(async () => await fs.unlink(dir).catch(() => {})) | ||
beforeAll(async () => { | ||
const paths = await cds2ts | ||
.compileFromFile(locations.unit.files('foreignkeys/model.cds'), { outputDirectory: dir }) | ||
ast = new ASTWrapper(path.join(paths[1], 'index.ts')) | ||
}) | ||
let astw | ||
beforeAll(async () => astw = (await prepareUnitTest('foreignkeys/model.cds', locations.testOutput('foreign_keys'))).astw) | ||
|
||
test('One Level Deep', async () => { | ||
expect(ast.exists('_BAspect', 'c_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(ast.exists('_BAspect', 'd_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(ast.exists('_CAspect', 'e_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(astw.exists('_BAspect', 'c_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(astw.exists('_BAspect', 'd_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(astw.exists('_CAspect', 'e_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
}) | ||
|
||
test('Two Levels Deep', async () => { | ||
expect(ast.exists('_AAspect', 'b_c_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(ast.exists('_AAspect', 'b_d_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(ast.exists('_BAspect', 'c_e_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(astw.exists('_AAspect', 'b_c_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(astw.exists('_AAspect', 'b_d_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(astw.exists('_BAspect', 'c_e_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
}) | ||
|
||
test('Three Levels Deep', async () => { | ||
expect(ast.exists('_AAspect', 'b_c_e_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
expect(astw.exists('_AAspect', 'b_c_e_ID', m => m.type.keyword === 'string')).toBeTruthy() | ||
}) | ||
}) |
Oops, something went wrong.