mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 12:01:57 +08:00
* 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
80 lines
2.8 KiB
JavaScript
80 lines
2.8 KiB
JavaScript
import {
|
|
convertBrowser,
|
|
convertForm,
|
|
convertProcess,
|
|
convertReportExportType,
|
|
convertTab,
|
|
convertValidationRule,
|
|
convertWindow
|
|
} from '../../../../../src/utils/ADempiere/apiConverts/dictionary'
|
|
import process from './objects/fromApi/process.json'
|
|
import convertedProcess from './objects/converted/process.json'
|
|
import processWithUndefined from './objects/fromApi/processWithUndefined.json'
|
|
import convertedProcessWithUndefined from './objects/converted/processWithUndefined.json'
|
|
import reportExportType from './objects/fromApi/reportExportType.json'
|
|
import convertedReportExportType from './objects/converted/reportExportType.json'
|
|
import tab from './objects/fromApi/tab.json'
|
|
import convertedTab from './objects/converted/tab.json'
|
|
import windowObj from './objects/fromApi/window.json'
|
|
import convertedWindow from './objects/converted/window.json'
|
|
import browser from './objects/fromApi/browser.json'
|
|
import convertedBrowser from './objects/converted/browser.json'
|
|
import form from './objects/fromApi/form.json'
|
|
import convertedForm from './objects/converted/form.json'
|
|
import validationRule from './objects/fromApi/validationRule.json'
|
|
import convertedValidationRule from './objects/converted/validationRule.json'
|
|
|
|
describe('process', () => {
|
|
it('should convert a process with all fields defined', () => {
|
|
const actualConvertedProcess = convertProcess(process)
|
|
expect(actualConvertedProcess).toEqual(convertedProcess)
|
|
})
|
|
|
|
it('should convert a process with some fields undefined', () => {
|
|
const actualConvertedProcess = convertProcess(processWithUndefined)
|
|
expect(actualConvertedProcess).toEqual(convertedProcessWithUndefined)
|
|
})
|
|
})
|
|
|
|
describe('report export type', () => {
|
|
it('should return a converted report export type object', () => {
|
|
const actualExportType = convertReportExportType(reportExportType)
|
|
expect(actualExportType).toEqual(convertedReportExportType)
|
|
})
|
|
})
|
|
|
|
describe('tab', () => {
|
|
it('should return a converted tab object', () => {
|
|
const actualTab = convertTab(tab)
|
|
expect(actualTab).toEqual(convertedTab)
|
|
})
|
|
})
|
|
|
|
describe('window', () => {
|
|
it('should return a converted window object', () => {
|
|
const actualWindow = convertWindow(windowObj)
|
|
expect(actualWindow).toEqual(convertedWindow)
|
|
})
|
|
})
|
|
|
|
describe('browser', () => {
|
|
it('should return a converted browser object', () => {
|
|
const actualBrowser = convertBrowser(browser)
|
|
expect(actualBrowser).toEqual(convertedBrowser)
|
|
})
|
|
})
|
|
|
|
describe('form', () => {
|
|
it('should return a converted form object', () => {
|
|
const actualForm = convertForm(form)
|
|
expect(actualForm).toEqual(convertedForm)
|
|
})
|
|
})
|
|
|
|
describe('validation rule', () => {
|
|
it('should return a converted validation rule object', () => {
|
|
const actualValidationRule = convertValidationRule(validationRule)
|
|
expect(actualValidationRule).toEqual(convertedValidationRule)
|
|
})
|
|
})
|