Skip to content
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

Thin out test fixtures #525

Merged
merged 2 commits into from
Apr 26, 2023
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
83 changes: 0 additions & 83 deletions packages/plugin-framework/spec/descriptor-registry.spec.ts

This file was deleted.

57 changes: 0 additions & 57 deletions packages/plugin-framework/spec/descriptor-tree.spec.ts

This file was deleted.

69 changes: 0 additions & 69 deletions packages/plugin-framework/spec/google-protobuf-descriptor.spec.ts

This file was deleted.

53 changes: 1 addition & 52 deletions packages/plugin-framework/spec/source-code-info.spec.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,4 @@
import {getFixtureFileDescriptor} from "./support/helpers";
import {
DescriptorParentFn,
DescriptorProto,
DescriptorRegistry,
FileDescriptorProto,
filterSourceCodeLocations,
makeSourceCodePath,
makeSourceCodePathComponent,
sourceCodeLocationToComment,
sourceCodeLocationToCursor
} from "../src/";
import {assert} from "@protobuf-ts/runtime";

const pathTo_MessageWithComments_Foo = [4, 0, 2, 0];
const cursor_MessageWithComments_Foo = [28, 5];


describe('sourceCodeLocationToComment()', function () {
const all = getFixtureFileDescriptor("comments.proto").sourceCodeInfo?.location ?? [];
const locations = filterSourceCodeLocations(all, pathTo_MessageWithComments_Foo);
it('seems to recognize comments correctly', function () {
const comments = sourceCodeLocationToComment(locations);
expect(comments.leadingDetached.length).toBe(1);
expect(comments.leading).toBeDefined();
expect(comments.trailing).toBeDefined();
});
});


describe('sourceCodeLocationToCursor()', function () {
const all = getFixtureFileDescriptor("comments.proto").sourceCodeInfo?.location ?? [];
const locations = filterSourceCodeLocations(all, pathTo_MessageWithComments_Foo);
it('returns expected cursor', function () {
const cursor = sourceCodeLocationToCursor(locations);
expect(cursor).toEqual(cursor_MessageWithComments_Foo);
});
});


describe('makeSourceCodePath()', function () {
const registry = DescriptorRegistry.createFrom(getFixtureFileDescriptor("comments.proto"));
const parents: DescriptorParentFn = d => registry.parentOf(d);
const message = registry.resolveTypeName('spec.MessageWithComments');
assert(DescriptorProto.is(message));
const field = message.field[0];
it('returns expected path', function () {
const path = makeSourceCodePath(parents, field);
expect(path).toEqual(pathTo_MessageWithComments_Foo);
});
});

import {DescriptorProto, FileDescriptorProto, makeSourceCodePathComponent} from "../src/";

describe('makeSourceCodePathComponent()', function () {
it('returns undefined for unknown combination ', () => {
Expand Down
84 changes: 0 additions & 84 deletions packages/plugin-framework/spec/support/helpers.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/runtime/spec/binary-reader.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {WireDataDelimited, WireDataPlain} from "./support/wire-data";
import {BinaryReader, WireType} from "../src";
import {msg_longs_bytes} from "../../test-fixtures/msg-longs.fixtures";
import {msg_longs_bytes} from "./support/msg-longs-fixture";


describe('BinaryReader', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/spec/binary-writer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {BinaryReader, BinaryWriter, WireType} from "../src";
import {WireDataDelimited, WireDataPlain} from "./support/wire-data";
import {msg_longs_bytes} from "../../test-fixtures/msg-longs.fixtures";
import {msg_longs_bytes} from "./support/msg-longs-fixture";


describe('BinaryWriter', () => {
Expand Down
Loading