Skip to content

Commit

Permalink
Minot fix + unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhprasad-sap committed Jul 11, 2024
1 parent 087e2a4 commit e4490d2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ module.exports = class CapOperatorAddPlugin extends cds.add.Plugin {
const xsuaaaYaml = yaml.parse(Mustache.render( await read(join(__dirname, '../files/xsuaa.yaml.hbs')), project))
await cds.add.merge(xsuaaaYaml).into(valuesYaml)

await merge(__dirname, '../files/xs-security.json.hbs').into('xs-security.json', {
await cds.add.merge(__dirname, '../files/xs-security.json.hbs').into('xs-security.json', {
project,
additions: [{ in: 'scopes', where: { name: '$XSAPPNAME.Callback' }}]
})
Expand Down
3 changes: 3 additions & 0 deletions test/add.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ describe('cds add cap-operator', () => {
expect(getFileHash(join(__dirname,'files/expectedChart/Chart.yaml'))).to.equal(getFileHash(join(bookshop, 'chart/Chart.yaml')))
expect(getFileHash(join(__dirname,'files/expectedChart/values.schema.json'))).to.equal(getFileHash(join(bookshop, 'chart/values.schema.json')))
expect(getFileHash(join(__dirname,'files/expectedChart/values.yaml'))).to.equal(getFileHash(join(bookshop, 'chart/values.yaml')))

// Check changes to xs-security.json
expect(getFileHash(join(__dirname,'files/xs-security.json'))).to.equal(getFileHash(join(bookshop, 'xs-security.json')))
})

it('Add cap-operator chart with force', async () => {
Expand Down
21 changes: 21 additions & 0 deletions test/files/xs-security.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"scopes": [
{
"name": "$XSAPPNAME.mtcallback",
"description": "Subscription via SaaS Registry",
"grant-as-authority-to-apps": [
"$XSAPPNAME(application,sap-provisioning,tenant-onboarding)"
]
},
{
"name": "$XSAPPNAME.Callback",
"description": "Subscription via SaaS Registry for CAP Operator",
"grant-as-authority-to-apps": [
"$XSAPPNAME(application,sap-provisioning,tenant-onboarding)"
]
}
],
"attributes": [],
"role-templates": [],
"authorities-inheritance": false
}

0 comments on commit e4490d2

Please sign in to comment.