Skip to content

Commit 080fc4b

Browse files
authored
fix: add test (#71)
* Use more portable scripting in publish Signed-off-by: Todd Baert <[email protected]> * fix: add test Signed-off-by: Todd Baert <[email protected]>
1 parent 333f9f0 commit 080fc4b

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

libs/hooks/open-telemetry/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"access": "public"
1212
},
1313
"scripts": {
14-
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [[ $(npm show $npm_package_name@$npm_package_version version) = $(npm run current-version -s) ]]; then echo 'already published, skipping'; else npm publish --access public; fi",
14+
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ $(npm show $npm_package_name@$npm_package_version version) = $(npm run current-version -s) ]; then echo 'already published, skipping'; else npm publish --access public; fi",
1515
"current-version": "echo $npm_package_version"
1616
},
1717
"license": "Apache-2.0"

libs/hooks/open-telemetry/src/lib/open-telemetry-hook.spec.ts

+15
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ describe('OpenTelemetry Hooks', () => {
113113
'true'
114114
);
115115
});
116+
117+
it('should set the value without extra quotes if value is already string', () => {
118+
const evaluationDetails: EvaluationDetails<string> = {
119+
flagKey: hookContext.flagKey,
120+
value: 'already-string',
121+
};
122+
123+
otelHook.before(hookContext);
124+
otelHook.after(hookContext, evaluationDetails);
125+
126+
expect(setAttribute).toBeCalledWith(
127+
'feature_flag.evaluated_value',
128+
'already-string'
129+
);
130+
});
116131
});
117132

118133
describe('error hook', () => {

libs/providers/go-feature-flag/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@openfeature/nodejs-sdk": "^0.0.1"
77
},
88
"scripts": {
9-
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [[ $(npm show $npm_package_name@$npm_package_version version) = $(npm run current-version -s) ]]; then echo 'already published, skipping'; else npm publish --access public; fi",
9+
"publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ $(npm show $npm_package_name@$npm_package_version version) = $(npm run current-version -s) ]; then echo 'already published, skipping'; else npm publish --access public; fi",
1010
"current-version": "echo $npm_package_version"
1111
}
1212
}

tools/generators/open-feature/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function updatePackage(tree: Tree, projectRoot: string) {
170170
updateJson(tree, joinPathFragments(projectRoot, 'package.json'), (json) => {
171171
json.scripts = {
172172
'publish-if-not-exists':
173-
"cp $NPM_CONFIG_USERCONFIG .npmrc && if [[ $(npm show $npm_package_name@$npm_package_version version) = $(npm run current-version -s) ]]; then echo 'already published, skipping'; else npm publish --access public; fi",
173+
"cp $NPM_CONFIG_USERCONFIG .npmrc && if [ $(npm show $npm_package_name@$npm_package_version version) = $(npm run current-version -s) ]; then echo 'already published, skipping'; else npm publish --access public; fi",
174174
'current-version': 'echo $npm_package_version',
175175
};
176176

0 commit comments

Comments
 (0)