-
Notifications
You must be signed in to change notification settings - Fork 4
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
test(lib/string): Add test for makeName #22 #24
Conversation
src/lib/string.test.js
Outdated
first_name: faker.name.firstName(), | ||
last_name: faker.name.lastName(), | ||
} | ||
const name = makeName(user) |
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.
Я бы переименовал в getUserFullname
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 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.
@sergeysova да, конечно, просто обратил внимание
src/lib/string.test.js
Outdated
} | ||
const name = makeName(user) | ||
|
||
t.true(/[a-z]/ig.test(name)) |
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.
Нет. Тут должна быть проверка, что функция вернула не просто набор неких символов. А именно имя и фамилию.
src/lib/string.test.js
Outdated
} | ||
const name = makeName(user) | ||
|
||
t.true(/[a-z]/ig.test(name)) |
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.
Как и здесь. Поможет метод t.is(a, b)
Обосрали ( |
@userbq201 t.is(makeName(user), `${user.first_name} ${user.last_name}`) Это не очевидно разве? |
Первый тест. Для makeName