-
Notifications
You must be signed in to change notification settings - Fork 6
JavaScript SDK: All unit tests passing (268/268), cross-SDK tests (138/138) #50
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
Open
joalves
wants to merge
13
commits into
main
Choose a base branch
from
fix/all-tests-passing-268-268
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
439623d
fix: code quality, type safety, error handling, and test coverage (26…
joalves 64eaaba
fix: address PR review comments
joalves b1b62cd
fix: drop async setTimeout/setInterval to avoid regenerator-runtime
joalves 5bd48d8
fix(jsonexpr): eq(null, null) returns null (canonical null-operand ha…
joalves 627be80
fix: audienceMismatch stays false for null audience eval; override al…
joalves f3b298a
revert: drop MATCH ReDoS hardening from this branch
joalves 1dfea88
fix: correct SDK alias casing to ABsmartly (brand convention)
joalves 9fa5123
test: add canonical astral/multibyte hashUnit regression test
joalves 2320d54
docs: remove client-side security warning; restore Publishing Pending…
joalves d096e05
feat!: release v2.0.0 — address PR #50 review feedback
joalves 2f83082
test: use rest-destructure to drop agent in client option test
joalves 7f5d191
fix: ignore js/ and types/ build output in prettier
joalves 7005381
test: add hermetic local-HTTP integration test for real fetch/publish
joalves File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -8,5 +8,6 @@ src/js/* | |
| !src/js/__tests__ | ||
| types | ||
| js | ||
| .claude/worktrees | ||
| .claude/ | ||
| .DS_Store | ||
| src/version.ts | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -2,5 +2,7 @@ node_modules | |
| coverage | ||
| dist | ||
| es | ||
| js | ||
| lib | ||
| types | ||
| package-lock.json | ||
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,65 @@ | ||||||||||||
| // Constructor option-merging tests for SDK and Client. | ||||||||||||
| // | ||||||||||||
| // These deliberately use the real SDK and Client constructors (no jest.mock), | ||||||||||||
| // so they exercise the actual _extractClientOptions / option-merge logic | ||||||||||||
| // rather than Jest doubles, which would make the assertions vacuous. | ||||||||||||
|
|
||||||||||||
|
Comment on lines
+1
to
+6
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| import SDK from "../sdk"; | ||||||||||||
| import Client from "../client"; | ||||||||||||
|
|
||||||||||||
| describe("SDK and Client constructor option merging", () => { | ||||||||||||
| it("should extract client options from SDK options and pass them to the real Client", () => { | ||||||||||||
| const sdk = new SDK({ | ||||||||||||
| agent: "test-agent", | ||||||||||||
| apiKey: "key", | ||||||||||||
| application: "app", | ||||||||||||
| endpoint: "http://localhost", | ||||||||||||
| environment: "test", | ||||||||||||
| timeout: 5000, | ||||||||||||
| }); | ||||||||||||
|
|
||||||||||||
| const client = sdk.getClient(); | ||||||||||||
| expect(client).toBeInstanceOf(Client); | ||||||||||||
| expect(client.getAgent()).toBe("test-agent"); | ||||||||||||
| expect(client.getEnvironment()).toBe("test"); | ||||||||||||
| expect(client.getApplication()).toEqual({ name: "app", version: 0 }); | ||||||||||||
| }); | ||||||||||||
|
|
||||||||||||
| it("should accept the SDK application option as an object", () => { | ||||||||||||
| const sdk = new SDK({ | ||||||||||||
| agent: "test", | ||||||||||||
| apiKey: "key", | ||||||||||||
| application: { name: "myapp", version: "1.2.3" }, | ||||||||||||
| endpoint: "http://localhost", | ||||||||||||
| environment: "prod", | ||||||||||||
| }); | ||||||||||||
|
|
||||||||||||
| expect(sdk.getClient().getApplication()).toEqual({ name: "myapp", version: "1.2.3" }); | ||||||||||||
| }); | ||||||||||||
|
|
||||||||||||
| it("should merge provided Client options with the defaults", () => { | ||||||||||||
| const client = new Client({ | ||||||||||||
| endpoint: "http://test", | ||||||||||||
| agent: "custom-agent", | ||||||||||||
| environment: "prod", | ||||||||||||
| apiKey: "key123", | ||||||||||||
| application: "myapp", | ||||||||||||
| timeout: 10000, | ||||||||||||
| }); | ||||||||||||
|
|
||||||||||||
| expect(client.getAgent()).toBe("custom-agent"); | ||||||||||||
| expect(client.getEnvironment()).toBe("prod"); | ||||||||||||
| expect(client.getApplication()).toEqual({ name: "myapp", version: 0 }); | ||||||||||||
| }); | ||||||||||||
|
|
||||||||||||
| it("should fall back to the default agent when it is omitted", () => { | ||||||||||||
| const client = new Client({ | ||||||||||||
| endpoint: "http://test", | ||||||||||||
| environment: "prod", | ||||||||||||
| apiKey: "key123", | ||||||||||||
| application: "myapp", | ||||||||||||
| }); | ||||||||||||
|
|
||||||||||||
| expect(client.getAgent()).toBe("javascript-client"); | ||||||||||||
| }); | ||||||||||||
| }); | ||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's double check the bump with Márcio - although I think the UID change needs to be major