Skip to content

Add component tests to the demo SDK#287

Merged
vladimir-rangelov merged 3 commits into
next-bidirectionalfrom
ci/add-component-tests
Jan 22, 2026
Merged

Add component tests to the demo SDK#287
vladimir-rangelov merged 3 commits into
next-bidirectionalfrom
ci/add-component-tests

Conversation

@vladimir-rangelov
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings January 22, 2026 09:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds comprehensive component testing infrastructure to the demo SDK. The changes reorganize the project structure from test_sdk to demo_sdk and introduce a new component test suite alongside existing unit tests.

Changes:

  • Renamed project directory from test_sdk to demo_sdk throughout package.json scripts
  • Added component test infrastructure with utilities for HTTP client operations and event subscription testing
  • Introduced TypeScript compilation step for unit tests and new test organization structure

Reviewed changes

Copilot reviewed 22 out of 36 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
tsconfig.json New TypeScript configuration for compiling unit tests
jest.config.json Updated test regex to support .mjs files
package.json Reorganized test scripts and updated all references from test_sdk to demo_sdk
test/suite/remove-unused-schemas.test.js Fixed import path after directory restructure
demo_sdk/test/unit/*.test.ts Updated import paths for relocated test files
demo_sdk/test/transpiled-suite/*.test.js Generated JavaScript files from TypeScript unit tests
demo_sdk/test/component/*.mjs New component tests for properties and events
demo_sdk/test/component/utils/* New utility modules for component testing
demo_sdk/sharedSchemas/types.json New shared type definitions
demo_sdk/schemas/types.json Extended type definitions for the SDK
demo_sdk/openrpc/*.json OpenRPC specification files for simple, provider, property, and event modules
demo_sdk/sdk/* SDK configuration and index files
demo_sdk/*.js Test harness and setup files
Comments suppressed due to low confidence (1)

demo_sdk/test/unit/simple.test.ts:50

  • Avoid automated semicolon insertion (93% of all statements in the enclosing script have an explicit semicolon).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

requestBasicMethod(...args) {
providerMethodRequestReceived = true;
throw {
message: 'An error occured!',
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a spelling error in "occured". This should be "occurred".

Copilot uses AI. Check for mistakes.
test('Provider method throw an exeption', () => {
expect(providerMethodRequestReceived).toBe(true);
expect(providerMethodErrorSent).toBe(true);
expect(errorMessage).toBe('An error occured!');
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a spelling error in "occured". This should be "occurred".

Copilot uses AI. Check for mistakes.
test('Provide method 1 called with two args', () => {
expect(numberOfArgsMethodOne).toBe(1);
});
test('Provide method 1 parame1 is true', () => {
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming in the test description "Provide method 1 parame1 is true" contains a typo. It should be "Provide method 1 param1 is true".

Suggested change
test('Provide method 1 parame1 is true', () => {
test('Provide method 1 param1 is true', () => {

Copilot uses AI. Check for mistakes.
Comment thread package.json Outdated
Comment on lines +14 to +16
"test:unit": "NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest ./test/suite",
"test:component": "NODE_OPTIONS=--experimental-vm-modules npx jest --runInBand ./demo_sdk/test/component",
"test": "npm run test:setup && npm run test:unit && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest ./demo_sdk/test/transpiled-suite",
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test script includes a mix of npx and npm run commands with inconsistent options. The --config=jest.config.json flag should come after jest, not after npx. The correct syntax should be npx jest --config=jest.config.json rather than npx --config=jest.config.json jest.

Copilot uses AI. Check for mistakes.
// this one is good as long as there's no errors yet
expect(1).toBe(1);
});
test('Provider method throw an exeption', () => {
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a spelling error in "exeption". This should be "exception".

Suggested change
test('Provider method throw an exeption', () => {
test('Provider method throw an exception', () => {

Copilot uses AI. Check for mistakes.
Comment thread package.json Outdated
"test:setup": "rm -rf demo_sdk/test/transpiled-suite && npx tsc --target es6 --moduleResolution node --outDir demo_sdk/test/transpiled-suite",
"test:unit": "NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest ./test/suite",
"test:component": "NODE_OPTIONS=--experimental-vm-modules npx jest --runInBand ./demo_sdk/test/component",
"test": "npm run test:setup && npm run test:unit && NODE_OPTIONS=--experimental-vm-modules npx --config=jest.config.json --detectOpenHandles jest ./demo_sdk/test/transpiled-suite",
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 16 contains inconsistent whitespace - it uses tabs instead of spaces like the rest of the file. This should use spaces for consistency with the rest of the package.json file.

Copilot uses AI. Check for mistakes.
import "./utils/bootstrap.mjs";


import { PropertyExtension, Simple, EventExtension } from "../../../build/sdk/javascript/src/sdk.mjs";
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import Simple.

Suggested change
import { PropertyExtension, Simple, EventExtension } from "../../../build/sdk/javascript/src/sdk.mjs";
import { PropertyExtension, EventExtension } from "../../../build/sdk/javascript/src/sdk.mjs";

Copilot uses AI. Check for mistakes.
Comment thread demo_sdk/test/component/event.test.mjs Outdated
@@ -0,0 +1,111 @@
import "./utils/bootstrap.mjs";

import { test, expect, describe } from "@jest/globals";
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import describe.

Suggested change
import { test, expect, describe } from "@jest/globals";
import { test, expect } from "@jest/globals";

Copilot uses AI. Check for mistakes.
beforeAll(() => {
transport.onSend((json) => {
if (json.method) {
let [module, method] = json.method.split('.');
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable method.

Suggested change
let [module, method] = json.method.split('.');
let [module] = json.method.split('.');

Copilot uses AI. Check for mistakes.
}
transport.onSend((json) => {
if (json.method) {
let [module, method] = json.method.split('.');
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable method.

Suggested change
let [module, method] = json.method.split('.');
const [module] = json.method.split('.');

Copilot uses AI. Check for mistakes.
@vladimir-rangelov vladimir-rangelov merged commit f33a8c5 into next-bidirectional Jan 22, 2026
1 of 2 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants