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

How to unit test expressions #9354

Closed
nreese opened this issue Feb 27, 2020 · 5 comments
Closed

How to unit test expressions #9354

nreese opened this issue Feb 27, 2020 · 5 comments

Comments

@nreese
Copy link

nreese commented Feb 27, 2020

Is there any way to unit test expressions? For example, I am working on an expression to pull a value from features and would like to set up a unit test that takes the expression and provides the output when passed features. Is this possible.

@ryanhamley
Copy link
Contributor

@nreese We have separate tests for expressions which aren't unit tests. The expression test runner is https://github.com/mapbox/mapbox-gl-js/blob/master/test/expression.test.js

Is this something you're planning on submitting as a PR for inclusion in the library?

@nreese
Copy link
Author

nreese commented Feb 27, 2020

Is this something you're planning on submitting as a PR for inclusion in the library?

No. Testing the output of expressions in isolation seems like a common use case across mapbox users. I am just curious if there was an easy way to test expressions.

@ryanhamley
Copy link
Contributor

Ah ok, it sounds like you're thinking more of a way to evaluate an expression outside of GL JS like #7670

@nreese
Copy link
Author

nreese commented Feb 27, 2020

it sounds like you're thinking more of a way to evaluate an expression outside of GL JS like #7670

Yes.

@ryanhamley
Copy link
Contributor

Cool, I'm going to close this as a duplicate so we can focus discussion in one ticket. Thanks!

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

2 participants