mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-17 18:44:45 +02:00
66 lines
881 B
TypeScript
66 lines
881 B
TypeScript
|
import errorsHaveChanged from './errorsHaveChanged';
|
||
|
|
||
|
describe('errorsHaveChanged', () => {
|
||
|
|
||
|
test('should tell if an errors object has changed', () => {
|
||
|
const testCases = [
|
||
|
[
|
||
|
{
|
||
|
'one': '111',
|
||
|
'two': '222',
|
||
|
},
|
||
|
{
|
||
|
'two': '222',
|
||
|
'one': '111',
|
||
|
},
|
||
|
false,
|
||
|
],
|
||
|
[
|
||
|
{
|
||
|
'one': '111',
|
||
|
'two': '222',
|
||
|
},
|
||
|
{
|
||
|
'one': '111',
|
||
|
'two': '222',
|
||
|
},
|
||
|
false,
|
||
|
],
|
||
|
[
|
||
|
{
|
||
|
'one': '111',
|
||
|
'two': '222',
|
||
|
},
|
||
|
{
|
||
|
'one': '111',
|
||
|
},
|
||
|
true,
|
||
|
],
|
||
|
[
|
||
|
{
|
||
|
'one': '111',
|
||
|
'two': '222',
|
||
|
},
|
||
|
{
|
||
|
'one': '222',
|
||
|
'two': '111',
|
||
|
},
|
||
|
true,
|
||
|
],
|
||
|
[
|
||
|
{},
|
||
|
{},
|
||
|
false,
|
||
|
],
|
||
|
];
|
||
|
|
||
|
for (const t of testCases) {
|
||
|
const [oldErrors, newErrors, expected] = t;
|
||
|
|
||
|
const result = errorsHaveChanged(oldErrors, newErrors);
|
||
|
expect(result).toBe(expected);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
});
|