Return of experiment with big shiny app#275
Conversation
yannrichet
commented
Aug 12, 2019
- add test for loadTimeout
- add testApp(...,normalizeContent=T, ...) option to disable false diff detected when json content order changes.
|
Thank you for the contribution! First, there seems to be a bug in this line: Also, just to be clear about the intention here, the normalization (actually I think the more commonly used word for this is "canonicalization") is to find all JSON objects (i.e. key/value pairs) and order their elements by key? This code does so recursively, but only objects directly nested within objects--I don't think objects inside arrays are covered (or objects inside of arrays of arrays, or arrays of objects of arrarys of objects...). I assume this won't work (the |
Yes, sorry.
ok. Do you wish I change the option name ? (to be honest I also feel it is not so clear for now...)
Well, you are right. Again.
No, I think it will reorder: order.list(list('d'=list('cc'=1,'bb'=0),'a'=1,'b'=2,'c'=3))
$a
[1] 1
$b
[1] 2
$c
[1] 3
$d
$d$bb
[1] 0
$d$cc
[1] 1but this one will not (and will even loose some data): So, I will fix that. |
|
I think it is fixed now. At least, unnamed elements are no longer lost... |
… text (like js tags or attributes)
|
Hi. I am still waiting for review about that, if you have some time... No problem if you want some improvement or refactoring of code, but I would really like to have these features integrated in mainstream version... |
… snapshotCompare args.
Error: lexical error: invalid character inside string.
{ "src": "[image data], "width": 291, "he
(right here) ------^
|
|
|
I believe I am also experiencing the same issue this pull request is addressing. When running devtools::test() all my tests pass but when running through devtools::check() the current json file is not in alphabetical key order (unlike the expected file). Running through a json comparison tool will identify the files are the same but a simple text comparison will fail as the keys are now not in order. I assume this is a similar issue to what @yannrichet was experiencing and trying to solve. Is there any update on this pull request and when we can expect it to be merged and released? |
|
At least, you can test my fork of shinytest. This could confirm it solves your issue. |