-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ [#4772] Add test for set_datatype_string converter
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from django.test import SimpleTestCase, tag | ||
|
||
from openforms.formio.typing import SelectComponent | ||
|
||
from ..migration_converters import set_datatype_string | ||
|
||
|
||
class SetDatatypeStringTests(SimpleTestCase): | ||
@tag("gh-4772") | ||
def test_set_datatype_string(self): | ||
configuration: SelectComponent = { | ||
"type": "select", | ||
"key": "select", | ||
"label": "Select", | ||
"data": { | ||
"values": [ | ||
{"label": "Option 1", "value": "1"}, | ||
{"label": "Option 2", "value": "2"}, | ||
] | ||
}, | ||
} | ||
|
||
set_datatype_string(configuration) | ||
|
||
assert "dataType" in configuration | ||
self.assertEqual(configuration["dataType"], "string") | ||
|
||
configuration: SelectComponent = { | ||
"type": "select", | ||
"key": "select", | ||
"label": "Select", | ||
"dataType": "integer", | ||
"data": { | ||
"values": [ | ||
{"label": "Option 1", "value": "1"}, | ||
{"label": "Option 2", "value": "2"}, | ||
] | ||
}, | ||
} | ||
|
||
set_datatype_string(configuration) | ||
|
||
assert "dataType" in configuration | ||
self.assertEqual(configuration["dataType"], "string") |