Skip to content

Commit

Permalink
Moved test protos to separate package
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Sachs <[email protected]>
  • Loading branch information
paul-sachs committed Oct 29, 2024
1 parent d69738d commit 136f56a
Show file tree
Hide file tree
Showing 40 changed files with 156 additions and 617 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const config = {
},
},
{
files: ["**/eliza/*", "**/gen/**", "**/snapshots/**"], // generated code
files: ["**/eliza/*", "gen/**", "**/gen/**", "**/snapshots/**"], // generated code
rules: {
"eslint-comments/no-unused-enable": "off",
"eslint-comments/no-unused-disable": "off",
Expand Down
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"git.enableCommitSigning": true,
"git.alwaysSignOff": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
3 changes: 1 addition & 2 deletions packages/connect-query-core/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
dist
coverage
src/gen
coverage
2 changes: 1 addition & 1 deletion packages/connect-query-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --moduleResolution node10 --verbatimModuleSyntax false --outDir ./dist/cjs --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.build.json",
"generate": "buf generate",
"test": "vitest --run",
"test:watch": "vitest --watch",
"format": "prettier . --write --ignore-path ./.eslintignore && eslint . --fix && license-header",
Expand All @@ -36,6 +35,7 @@
"@bufbuild/protoc-gen-es": "^2.2.0",
"@connectrpc/connect": "^2.0.0-rc.1",
"@connectrpc/connect-web": "^2.0.0-rc.1",
"test-utils": "workspace:*",
"typescript": "^5.5.4"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-query-core/src/connect-query-key.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

import { create } from "@bufbuild/protobuf";
import type { Transport } from "@connectrpc/connect";
import { ElizaService, SayRequestSchema } from "test-utils/gen/eliza_pb.js";
import { ListRequestSchema, ListService } from "test-utils/gen/list_pb.js";
import { describe, expect, it } from "vitest";

import { createConnectQueryKey } from "./connect-query-key.js";
import { ElizaService, SayRequestSchema } from "./gen/eliza_pb.js";
import { ListRequestSchema, ListService } from "./gen/list_pb.js";
import { skipToken } from "./index.js";
import { createMessageKey } from "./message-key.js";
import { createTransportKey } from "./transport-key.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-query-core/src/create-query-options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
// limitations under the License.

import { skipToken as tanstackSkipToken } from "@tanstack/query-core";
import { mockEliza } from "test-utils";
import { ElizaService } from "test-utils/gen/eliza_pb.js";
import { describe, expect, expectTypeOf, it } from "vitest";

import { createConnectQueryKey } from "./connect-query-key.js";
import { createQueryOptions } from "./create-query-options.js";
import { ElizaService } from "./gen/eliza_pb.js";
import { skipToken } from "./index.js";
import { mockEliza } from "./test/test-utils.js";

// TODO: maybe create a helper to take a service and method and generate this.
const sayMethodDescriptor = ElizaService.method.say;
Expand Down
4 changes: 2 additions & 2 deletions packages/connect-query-core/src/message-key.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
// limitations under the License.

import { create } from "@bufbuild/protobuf";
import { Proto2MessageSchema } from "test-utils/gen/proto2_pb.js";
import { Proto3Enum, Proto3MessageSchema } from "test-utils/gen/proto3_pb.js";
import { describe, expect, it } from "vitest";

import { Proto2MessageSchema } from "./gen/proto2_pb.js";
import { Proto3Enum, Proto3MessageSchema } from "./gen/proto3_pb.js";
import { createMessageKey } from "./message-key.js";

describe("message key", () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/connect-query-core/src/structural-sharing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
// limitations under the License.

import { create } from "@bufbuild/protobuf";
import {
SayRequestSchema,
SayResponseSchema,
} from "test-utils/gen/eliza_pb.js";
import { describe, expect, it } from "vitest";

import { SayRequestSchema, SayResponseSchema } from "./gen/eliza_pb.js";
import { createStructuralSharing } from "./structural-sharing.js";

describe("structural sharing", () => {
Expand Down
52 changes: 0 additions & 52 deletions packages/connect-query-core/src/test/test-utils.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/connect-query-core/src/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
// limitations under the License.

import { create, isFieldSet, isMessage } from "@bufbuild/protobuf";
import { Proto2MessageSchema } from "test-utils/gen/proto2_pb.js";
import { describe, expect, it } from "vitest";

import { Proto2MessageSchema } from "./gen/proto2_pb.js";
import {
assert,
createProtobufSafeUpdater,
Expand Down
2 changes: 1 addition & 1 deletion packages/connect-query-core/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"outDir": "./dist/esm"
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["**/*.test.ts", "**/*.test.tsx", "src/test/**", "src/gen/**"]
"exclude": ["**/*.test.ts", "**/*.test.tsx", "src/test/**"]
}
12 changes: 0 additions & 12 deletions packages/connect-query/buf.gen.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion packages/connect-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --moduleResolution node10 --verbatimModuleSyntax false --outDir ./dist/cjs --declarationDir ./dist/cjs && echo >./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
"build:esm": "tsc --project tsconfig.build.json",
"generate": "buf generate",
"test": "vitest --run",
"test:watch": "vitest --watch",
"format": "prettier . --write --ignore-path ./.eslintignore && eslint . --fix && license-header",
Expand Down Expand Up @@ -45,6 +44,7 @@
"@types/react-dom": "^18.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"test-utils": "workspace:*",
"typescript": "^5.5.4"
},
"peerDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions packages/connect-query/src/call-unary-method.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import {
import type { QueryFunctionContext } from "@tanstack/react-query";
import { useQueries } from "@tanstack/react-query";
import { renderHook, waitFor } from "@testing-library/react";
import { mockEliza } from "test-utils";
import type { SayRequest } from "test-utils/gen/eliza_pb.js";
import { ElizaService, SayRequestSchema } from "test-utils/gen/eliza_pb.js";
import { describe, expect, it } from "vitest";

import type { SayRequest } from "./gen/eliza_pb.js";
import { ElizaService, SayRequestSchema } from "./gen/eliza_pb.js";
import { mockEliza, wrapper } from "./test/test-utils.js";
import { wrapper } from "./test/test-wrapper.js";

describe("callUnaryMethod", () => {
it("can be used with useQueries", async () => {
Expand Down
87 changes: 0 additions & 87 deletions packages/connect-query/src/gen/bigint_pb.ts

This file was deleted.

90 changes: 0 additions & 90 deletions packages/connect-query/src/gen/eliza_pb.ts

This file was deleted.

Loading

0 comments on commit 136f56a

Please sign in to comment.