Skip to content

fix: add test #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/hooks/open-telemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"access": "public"
},
"scripts": {
"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",
"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",
"current-version": "echo $npm_package_version"
},
"license": "Apache-2.0"
Expand Down
15 changes: 15 additions & 0 deletions libs/hooks/open-telemetry/src/lib/open-telemetry-hook.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ describe('OpenTelemetry Hooks', () => {
'true'
);
});

it('should set the value without extra quotes if value is already string', () => {
const evaluationDetails: EvaluationDetails<string> = {
flagKey: hookContext.flagKey,
value: 'already-string',
};

otelHook.before(hookContext);
otelHook.after(hookContext, evaluationDetails);

expect(setAttribute).toBeCalledWith(
'feature_flag.evaluated_value',
'already-string'
);
});
});

describe('error hook', () => {
Expand Down
2 changes: 1 addition & 1 deletion libs/providers/go-feature-flag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@openfeature/nodejs-sdk": "^0.0.1"
},
"scripts": {
"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",
"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",
"current-version": "echo $npm_package_version"
}
}
2 changes: 1 addition & 1 deletion tools/generators/open-feature/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function updatePackage(tree: Tree, projectRoot: string) {
updateJson(tree, joinPathFragments(projectRoot, 'package.json'), (json) => {
json.scripts = {
'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",
"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",
'current-version': 'echo $npm_package_version',
};

Expand Down