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

Tests/setup #17

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Tests/setup #17

wants to merge 13 commits into from

Conversation

ff6347
Copy link
Member

@ff6347 ff6347 commented Oct 28, 2019

Add assertion helpers

@ff6347
Copy link
Member Author

ff6347 commented Oct 30, 2019

@lumenn

#15 (comment)

I tested the old one in InDesign and it works. Tested the new one and it works as well.
I'll be setting up a small testing utility we can use the write test we can run locally.

Anything i could help with?

Totally. Writing test for all shims would be awesome. Between child, job and teaching I find little time for fun coding projects 😞

Take a look at this file

If you start adding test for some shims in that way we will be done in notime

@ff6347
Copy link
Member Author

ff6347 commented Oct 30, 2019

@lumenn If you start here, there are two different kinds of tests here.

The file __tests__/manual.js is meant to be run on a local machine from within Adobe products.

In the end we should have one file where all local tests are combined so we can run them in one call.

The other ones like __tests__/array.test.js are meant to be run on a CI server (e.g. GitHub Actions or Travis) using jest. That is whey they have the removal of the shims in beforeAll(() => {}) and we can make use of arrow functions.

It would be perfect if we can use the same files for local and CI testing but I still have to do some work on the assertion framework. My idea is to implement a subset of the jest commands so we can run them in both frameworks.

Anyway. If you start writing test look at __tests__/manual.js and ignore the additional stuff in __tests__/array.test.js.

@lumenn
Copy link
Member

lumenn commented Oct 30, 2019

I'll jump on it today, thanks for directions

@lumenn
Copy link
Member

lumenn commented Oct 30, 2019

Whole Array is now covered, those are simple tests, if we need to make them more specific, let me know, and i'll update those.

Give me some feedback on those and, if those are fine, then maybe i'll jump to another functions.

Copy link
Member Author

@ff6347 ff6347 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything awesome except for this new function in the assertions.js

@@ -33,6 +33,16 @@ function expect(actual) {
throw new Error(actual + " is not equal to " + expected);
}
},
toEqualArray: function(expected) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function taken from jest source?
Would be good if we not introduce new functions. This would allow to use jest on the CI server.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's one i wrote.
Current functions don't allow to compare arrays, so that's how this one ended up here.

We should only stick to those 4 functions we already have?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. My master plan is to write only functions jest also understands. So we can have tests running on Adobe products and also on CI server.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://repl.it/repls/NormalEmptyClicks

It seems that we should correct our implementation of toEqual, as in jest it can easily compare arrays. Testing our implementation in InDesign doesn't pass.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally. I just hacked that together. Really needs some love. :) Maybe I'll find some space at the weekend for it

@ff6347 ff6347 mentioned this pull request Jan 5, 2020
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

Successfully merging this pull request may close these issues.

2 participants