-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add new settings for python and go ecosystems
Signed-off-by: Ilona Shishov <[email protected]>
- Loading branch information
1 parent
ca4be57
commit 3a0c635
Showing
10 changed files
with
146 additions
and
18 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 @@ | ||
'use strict'; | ||
|
||
import { settingNameMappings } from './constants'; | ||
|
||
export function applySettingNameMappings(message: string): string { | ||
let modifiedMessage = message; | ||
|
||
Object.keys(settingNameMappings).forEach(key => { | ||
const regex = new RegExp(key, 'g'); | ||
modifiedMessage = modifiedMessage.replace(regex, settingNameMappings[key]); | ||
}); | ||
|
||
return modifiedMessage; | ||
} |
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,53 @@ | ||
import * as chai from 'chai'; | ||
import * as sinon from 'sinon'; | ||
import * as sinonChai from 'sinon-chai'; | ||
|
||
import { settingNameMappings } from '../src/constants'; | ||
import { applySettingNameMappings } from '../src/utils'; | ||
|
||
const expect = chai.expect; | ||
chai.use(sinonChai); | ||
|
||
suite('Utils module', () => { | ||
let sandbox: sinon.SinonSandbox; | ||
|
||
setup(() => { | ||
sandbox = sinon.createSandbox(); | ||
}); | ||
|
||
teardown(() => { | ||
sandbox.restore(); | ||
}); | ||
|
||
test('should return a string with applied mappings', () => { | ||
|
||
Object.keys(settingNameMappings).forEach(key => { | ||
const message = `The ${key} variable should be set.`; | ||
const expectedMessage = `The ${settingNameMappings[key]} variable should be set.`; | ||
|
||
const result = applySettingNameMappings(message); | ||
|
||
expect(result).to.equal(expectedMessage); | ||
}); | ||
}); | ||
|
||
test('should handle multiple occurrences of mapping keys', () => { | ||
|
||
Object.keys(settingNameMappings).forEach(key => { | ||
const message = `Please ensure the ${key} is properly configured. Set ${key} to true.`; | ||
const expectedMessage = `Please ensure the ${settingNameMappings[key]} is properly configured. Set ${settingNameMappings[key]} to true.`; | ||
|
||
const result = applySettingNameMappings(message); | ||
|
||
expect(result).to.equal(expectedMessage); | ||
}); | ||
}); | ||
|
||
test('should not modify the message if no mappings apply', () => { | ||
const message = 'This message does not contain any mapping keys.'; | ||
|
||
const result = applySettingNameMappings(message); | ||
|
||
expect(result).to.equal(message); | ||
}); | ||
}); |