Skip to content

Commit

Permalink
test: fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Dec 4, 2024
1 parent c136782 commit 13c42e7
Showing 1 changed file with 31 additions and 23 deletions.
54 changes: 31 additions & 23 deletions test/bindings/vinejs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ test.group('VineJS | unique', (group) => {
} catch (error) {
if (dialectPerformsCaseSensitiveSearch) {
assert.deepEqual(error.messages, [
{
field: 'username',
message: 'The username has already been taken',
rule: 'database.unique',
},
{
field: 'email',
message: 'The email has already been taken',
Expand Down Expand Up @@ -337,29 +342,32 @@ test.group('VineJS | exists', (group) => {
})
)

try {
await validator.validate({
/**
* Username validation will fail because of case
* mismatch
*/
username: 'foo',
/**
* Email validation will pass regardless of the
* case mismatch
*/
email: '[email protected]',
})
} catch (error) {
if (dialectPerformsCaseSensitiveSearch) {
assert.deepEqual(error.messages, [
{
field: 'email',
message: 'The email has already been taken',
rule: 'database.unique',
},
])
} else {
if (dialectPerformsCaseSensitiveSearch) {
assert.deepEqual(
await validator.validate({
username: 'foo',
email: '[email protected]',
}),
{
username: 'foo',
email: '[email protected]',
}
)
} else {
try {
await validator.validate({
/**
* Username validation will fail because of case
* mismatch
*/
username: 'foo',
/**
* Email validation will pass regardless of the
* case mismatch
*/
email: '[email protected]',
})
} catch (error) {
assert.deepEqual(error.messages, [
{
field: 'username',
Expand Down

0 comments on commit 13c42e7

Please sign in to comment.