Skip to content

Commit

Permalink
a few tests to demonstrate a few failing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed Dec 4, 2023
1 parent 0aaf308 commit 22c47a6
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion src/__tests__/json-completion.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, it } from "vitest";

import { expectCompletion } from "./__helpers__/completion.js";
import { expectCompletion } from "./__helpers__/completion";
import { testSchema3, testSchema4 } from "./__fixtures__/schemas";

describe("jsonCompletion", () => {
it("should return completion data for simple types", async () => {
Expand Down Expand Up @@ -291,6 +292,57 @@ describe("jsonCompletion", () => {
},
]);
});
it("should autocomplete for array of objects with filter", async () => {
await expectCompletion('{ "arrayOfObjects": [ { "f|" } ] }', [
{
detail: "string",
info: "",
label: "foo",
template: '"foo": "#{}"',
type: "property",
},
]);
});
it("should autocomplete for a schema with top level $ref", async () => {
await expectCompletion(
'{ "| }',
[
{
type: "property",
detail: "string",
info: "",
label: "foo",
},
{
type: "property",
detail: "number",
info: "",
label: "bar",
},
],
{ schema: testSchema3 }
);
});
it("should autocomplete for a schema with top level complex type", async () => {
await expectCompletion(
'{ "| }',
[
{
type: "property",
detail: "string",
info: "",
label: "foo",
},
{
type: "property",
detail: "number",
info: "",
label: "bar",
},
],
{ schema: testSchema4 }
);
});
});

describe("json5Completion", () => {
Expand Down

0 comments on commit 22c47a6

Please sign in to comment.