Skip to content

Commit

Permalink
test: add test for multibytes charactesr
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh committed Aug 6, 2024
1 parent 94c2194 commit 381eb27
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion packages/language-server/test/typescript/scripts.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FullDocumentDiagnosticReport, Position } from '@volar/language-server';
import { type FullDocumentDiagnosticReport, Position, Range } from '@volar/language-server';
import { expect } from 'chai';
import { type LanguageServer, getLanguageServer } from '../server.js';

Expand Down Expand Up @@ -59,4 +59,19 @@ describe('TypeScript - Diagnostics', async () => {

expect(hoverInfo).to.be.null;
});

it('supports script tags in files with multibytes characters', async () => {
const document = await languageServer.openFakeDocument(
`πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€
<script>doesntExists</script>`,
'astro'
);

const diagnostics = (await languageServer.handle.sendDocumentDiagnosticRequest(
document.uri
)) as FullDocumentDiagnosticReport;

expect(diagnostics.items).length(1);
expect(diagnostics.items[0].range).to.deep.equal(Range.create(1, 8, 1, 20));
});
});

0 comments on commit 381eb27

Please sign in to comment.