-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
761f823
commit c136782
Showing
4 changed files
with
136 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,9 @@ import { defineValidationRules } from '../../src/bindings/vinejs.js' | |
import { getConfig, setup, cleanup, logger, createEmitter } from '../../test-helpers/index.js' | ||
|
||
let db: Database | ||
const dialectPerformsCaseSensitiveSearch = ['mysql', 'mysql_legacy', 'mssql'].includes( | ||
process.env.DB! | ||
) | ||
|
||
test.group('VineJS | unique', (group) => { | ||
group.setup(async () => { | ||
|
@@ -102,13 +105,23 @@ test.group('VineJS | unique', (group) => { | |
email: '[email protected]', | ||
}) | ||
} catch (error) { | ||
assert.deepEqual(error.messages, [ | ||
{ | ||
field: 'email', | ||
message: 'The email has already been taken', | ||
rule: 'database.unique', | ||
}, | ||
]) | ||
if (dialectPerformsCaseSensitiveSearch) { | ||
assert.deepEqual(error.messages, [ | ||
{ | ||
field: 'email', | ||
message: 'The email has already been taken', | ||
rule: 'database.unique', | ||
}, | ||
]) | ||
} else { | ||
assert.deepEqual(error.messages, [ | ||
{ | ||
field: 'email', | ||
message: 'The email has already been taken', | ||
rule: 'database.unique', | ||
}, | ||
]) | ||
} | ||
} | ||
}) | ||
|
||
|
@@ -338,13 +351,23 @@ test.group('VineJS | exists', (group) => { | |
email: '[email protected]', | ||
}) | ||
} catch (error) { | ||
assert.deepEqual(error.messages, [ | ||
{ | ||
field: 'username', | ||
message: 'The selected username is invalid', | ||
rule: 'database.exists', | ||
}, | ||
]) | ||
if (dialectPerformsCaseSensitiveSearch) { | ||
assert.deepEqual(error.messages, [ | ||
{ | ||
field: 'email', | ||
message: 'The email has already been taken', | ||
rule: 'database.unique', | ||
}, | ||
]) | ||
} else { | ||
assert.deepEqual(error.messages, [ | ||
{ | ||
field: 'username', | ||
message: 'The selected username is invalid', | ||
rule: 'database.exists', | ||
}, | ||
]) | ||
} | ||
} | ||
}) | ||
|
||
|