Skip to content

Commit

Permalink
Fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohaszing committed May 2, 2024
1 parent d02e0dd commit f874ba3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 28 deletions.
28 changes: 20 additions & 8 deletions packages/language-server/test/completion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,21 @@ test('support completion in ESM', async () => {
assert.deepEqual(completion, {
commitCharacters: ['.', ',', ';', '('],
data: {
embeddedDocumentUri:
'volar-embedded-content://jsx/' +
encodeURIComponent(fixtureUri('node16/completion.mdx')),
original: {
data: {
fileName: fixturePath('node16/completion.mdx'),
offset: 81,
originalItem: {name: 'Boolean'},
uri: fixtureUri('node16/completion.mdx?virtualCodeId=jsx')
uri:
'volar-embedded-content://jsx/' +
encodeURIComponent(fixtureUri('node16/completion.mdx'))
}
},
serviceIndex: 2,
uri: fixtureUri('node16/completion.mdx'),
virtualDocumentUri: fixtureUri('node16/completion.mdx?virtualCodeId=jsx')
uri: fixtureUri('node16/completion.mdx')
},
insertTextFormat: InsertTextFormat.PlainText,
kind: CompletionItemKind.Variable,
Expand All @@ -61,7 +65,9 @@ test('support completion in ESM', async () => {
fileName: fixturePath('node16/completion.mdx'),
offset: 81,
originalItem: {name: 'Boolean'},
uri: fixtureUri('node16/completion.mdx?virtualCodeId=jsx')
uri:
'volar-embedded-content://jsx/' +
encodeURIComponent(fixtureUri('node16/completion.mdx'))
},
detail: 'interface Boolean\nvar Boolean: BooleanConstructor',
documentation: {kind: 'markdown', value: ''},
Expand Down Expand Up @@ -92,17 +98,21 @@ test('support completion in JSX', async () => {
assert.deepEqual(completion, {
commitCharacters: ['.', ',', ';', '('],
data: {
embeddedDocumentUri:
'volar-embedded-content://jsx/' +
encodeURIComponent(fixtureUri('node16/completion.mdx')),
original: {
data: {
fileName: fixturePath('node16/completion.mdx'),
offset: 119,
originalItem: {name: 'Boolean'},
uri: fixtureUri('node16/completion.mdx?virtualCodeId=jsx')
uri:
'volar-embedded-content://jsx/' +
encodeURIComponent(fixtureUri('node16/completion.mdx'))
}
},
serviceIndex: 2,
uri: fixtureUri('node16/completion.mdx'),
virtualDocumentUri: fixtureUri('node16/completion.mdx?virtualCodeId=jsx')
uri: fixtureUri('node16/completion.mdx')
},
insertTextFormat: InsertTextFormat.PlainText,
kind: CompletionItemKind.Variable,
Expand All @@ -117,7 +127,9 @@ test('support completion in JSX', async () => {
fileName: fixturePath('node16/completion.mdx'),
offset: 119,
originalItem: {name: 'Boolean'},
uri: fixtureUri('node16/completion.mdx?virtualCodeId=jsx')
uri:
'volar-embedded-content://jsx/' +
encodeURIComponent(fixtureUri('node16/completion.mdx'))
},
detail: 'interface Boolean\nvar Boolean: BooleanConstructor',
documentation: {kind: 'markdown', value: ''},
Expand Down
24 changes: 16 additions & 8 deletions packages/language-server/test/diagnostics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ test('parse errors', async () => {
href: 'https://github.com/micromark/micromark-extension-mdxjs-esm#could-not-parse-importexports-with-acorn'
},
data: {
documentUri: fixtureUri('node16/syntax-error.mdx?virtualCodeId=mdx'),
documentUri:
'volar-embedded-content://mdx/' +
encodeURIComponent(fixtureUri('node16/syntax-error.mdx')),
isFormat: false,
original: {},
serviceIndex: 1,
uri: fixtureUri('node16/syntax-error.mdx'),
version: 1
version: 0
},
message: 'Could not parse import/exports with acorn',
range: {
Expand Down Expand Up @@ -73,12 +75,14 @@ test('type errors', async () => {
{
code: 2568,
data: {
documentUri: fixtureUri('node16/type-errors.mdx?virtualCodeId=jsx'),
documentUri:
'volar-embedded-content://jsx/' +
encodeURIComponent(fixtureUri('node16/type-errors.mdx')),
isFormat: false,
original: {},
serviceIndex: 2,
uri: fixtureUri('node16/type-errors.mdx'),
version: 1
version: 0
},
message:
"Property 'counter' may not exist on type '{ readonly count: number; readonly components?: {}; }'. Did you mean 'count'?",
Expand All @@ -92,12 +96,14 @@ test('type errors', async () => {
{
code: 2568,
data: {
documentUri: fixtureUri('node16/type-errors.mdx?virtualCodeId=jsx'),
documentUri:
'volar-embedded-content://jsx/' +
encodeURIComponent(fixtureUri('node16/type-errors.mdx')),
isFormat: false,
original: {},
serviceIndex: 2,
uri: fixtureUri('node16/type-errors.mdx'),
version: 1
version: 0
},
message:
"Property 'counts' may not exist on type 'Props'. Did you mean 'count'?",
Expand Down Expand Up @@ -149,12 +155,14 @@ test('provided components', async () => {
{
code: 2741,
data: {
documentUri: fixtureUri('provide/solar-system.mdx?virtualCodeId=jsx'),
documentUri:
'volar-embedded-content://jsx/' +
encodeURIComponent(fixtureUri('provide/solar-system.mdx')),
isFormat: false,
original: {},
serviceIndex: 2,
uri: fixtureUri('provide/solar-system.mdx'),
version: 1
version: 0
},
message:
"Property 'distanceFromStar' is missing in type '{ name: string; radius: number; }' but required in type 'PlanetProps'.",
Expand Down
9 changes: 3 additions & 6 deletions packages/language-server/test/document-link.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@ test('resolve markdown link references', async () => {
pathText: 'mdx',
resource: {
$mid: 1,
path: fixturePath('node16/link-reference.mdx').replace(
/^\/?/,
'/'
),
query: 'virtualCodeId=md',
scheme: 'file'
authority: 'md',
path: '/' + fixtureUri('node16/link-reference.mdx'),
scheme: 'volar-embedded-content'
},
range: {
start: {line: 0, character: 8},
Expand Down
9 changes: 3 additions & 6 deletions packages/language-server/test/initialize.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,9 @@ test('initialize', async () => {
textDocumentSync: 2,
typeDefinitionProvider: true,
workspace: {
fileOperations: {
willRename: {
filters: [
{pattern: {glob: '**/*.{cjs,cts,js,jsx,json,mdx,mjs,mts,ts,tsx}'}}
]
}
workspaceFolders: {
changeNotifications: true,
supported: true
}
},
workspaceSymbolProvider: true
Expand Down

0 comments on commit f874ba3

Please sign in to comment.