-
Notifications
You must be signed in to change notification settings - Fork 93
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
Snapshot test for usernameToColor function #1346
Conversation
const snapshot = require('./../src/functions/usernameToColor/__snapshots__/usernameToColor.spec.js.snap') | ||
const result = {} | ||
Object.keys(snapshot).map((key) => { | ||
const uid = key.replace('usernameToColor ', '').replace(' has the proper color 1', '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be a more sane way to properly deserialize the jest snapshot but for now this does the trick
Can we also have a tests for
|
src/functions/usernameToColor/__snapshots__/usernameToColor.spec.js.snap
Outdated
Show resolved
Hide resolved
25bd5a2
to
3aeccc4
Compare
Ping? :D |
Pong .... Waiting for reviews 😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
3aeccc4
to
cb71924
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works!
This adds some basic snapshot testing for the usernameToColor functionality, which mainly aims to get a testset that we can use to test different implementations of the same algorithm against, e.g. in the android app.
A JSON export can be generated with
node ./build/usernameToColor-export.js
JSON output for the current snapshot
{"":"#0082c9",",":"#1e78c1",".":"#c98879","123e4567-e89b-12d3-a456-426614174000":"#bc5c91","Akeel Robertson":"#9750a4","Alishia Ann Lowry":"#d09e6d","Arham Johnson":"#0082c9","Brayden Truong":"#d09e6d","Daphne Roy":"#9750a4","Ellena Wright Frederic Conway":"#c37285","Gianluca Hills":"#d6b461","Haseeb Stephens":"#d6b461","Idris Mac":"#9750a4","Kristi Fisher":"#0082c9","Lillian Wall":"#bc5c91","Lorelai Taylor":"#ddcb55","Madina Knight":"#9750a4","Meeting":"#c98879","Private Circle":"#c37285","Rae Hope":"#795aab","Santiago Singleton":"#bc5c91","Sid Combs":"#d09e6d","TestCircle":"#499aa2","Tom Mörtel":"#248eb5","Vivienne Jacobs":"#1e78c1","Zaki Cortes":"#6ea68f","a user":"#5b64b3","admin":"#d09e6d","admin@cloud.example.com":"#9750a4","another user":"#ddcb55","asd":"#248eb5","bar":"#0082c9","foo":"#d09e6d","wasd":"#b6469d","مرحبا بالعالم":"#c98879","🙈":"#b6469d"}
cc @tobiasKaminsky