1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +08:00
Sofia Calderon 7a22c9e85b
Refactoring apiConverts (#817)
* configured babel and jest to work with webpack

* added util function to camelize object entries

* added tests for apiconvert dashboard

* added enaming object key function

* finished refactoring of convertapi dashboard

* renamed camelize to transformObject

* renamed uuids to randomValues

* use random strings instead of hard coded values in test

* refactored dictionary.process and added tests

* refactored dashboard tests - test with json objects

* added first tests for apiConvert core

* made camelizeObjectkeys immutable

* added talismanrc to gitignore

* added all tests for apiConverts core

* added more dictionary tests

* finished refactoring apiConverts dictionary

* restructured objects in folders

* refactored apiConverts persistence

* refactored apiConvert pos

* refactored apiConvert privateAccess

* refactored apiConverts process

* refactored apiConverts report

* refactored apiConverts user

* refactored apiConverts values

* refactored apiConverts window

* linted all test files

* removed tests for privateAccess

* removed typos from prev implementation
2021-05-12 12:34:53 -04:00

30 lines
1.3 KiB
JavaScript

import { convertRecentItemsList, convertFavorite, convertDashboard, convertPendingDocument } from '../../../../../src/utils/ADempiere/apiConverts/dashboard'
import recentListItems from './objects/fromApi/recentListItems.json'
import convertedRecentListItems from './objects/converted/recentListItems.json'
import favorite from './objects/fromApi/favorite.json'
import convertedFavorite from './objects/converted/favorite.json'
import dashboard from './objects/fromApi/dashboard.json'
import convertedDashboard from './objects/converted/dashboard.json'
import pendingDocument from './objects/fromApi/pendingDocument.json'
import convertedPendingDocument from './objects/converted/pendingDocument.json'
it('should convert the recent item list', () => {
const actualConvertedList = convertRecentItemsList(recentListItems)
expect(actualConvertedList).toEqual(convertedRecentListItems)
})
it('should convert the favorite', () => {
const actualFavorite = convertFavorite(favorite)
expect(actualFavorite).toEqual(convertedFavorite)
})
it('should convert dashboard', () => {
const actualDashbaord = convertDashboard(dashboard)
expect(actualDashbaord).toEqual(convertedDashboard)
})
it('should convert a pending document', () => {
const actualPendingDocument = convertPendingDocument(pendingDocument)
expect(actualPendingDocument).toEqual(convertedPendingDocument)
})