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

Expose standard-template-source-helper to get TemplateContext for unit tests #28

Open
matteematt opened this issue May 9, 2023 · 0 comments

Comments

@matteematt
Copy link

Hi. I am currently working on building a language server plugin for custom elements for microsoft FAST . I have a basic example working when running the plugin, but I would like to write unit tests for it so I can work TDD, and more easily spot regressions.

I have functions I would like to test which take the TemplateContext and LineAndCharacter to return CompletionInfo but I need a way to get a TemplateContext from my test tagged templates.

  1. For now I can just manually set up the interface from a raw string as best I as I can during the test, using jest.mock for typescript itself as well as the AST node
  2. Is it possible to change this library to get an instance of StandardTemplateSourceHelper so I can get the TemplateContext myself, or would this not be possible during the unit tests anyway as we are running in jest via node rather than the typescript runtime?
  3. Is there a different way to approach this problem that I am not seeing?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant