Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added test that shows issue with absolute path #122

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"./error": "./lib/error/index.js"
},
"scripts": {
"test": "TEST=1 nyc --reporter=lcov --reporter=text --reporter=text-summary mocha -r ts-node/register -r tsconfig-paths/register -r mock-local-storage -r jsdom-global/register -t 0 'src/**/__tests__/*.test.ts'",
"test": "TEST=1 mocha -r ts-node/register -r tsconfig-paths/register -r mock-local-storage -r jsdom-global/register -t 0 'src/**/__tests__/*.test.ts'",
"lib": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
"lib:watch": "tsc -w & tsc-alias -w",
"replace": "node -r tsconfig-paths/register -r ts-node/register ./lib/base/array/ArrayComponent.js",
Expand Down
44 changes: 44 additions & 0 deletions src/utils/__tests__/getComponentAbsolutePath.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { expect } from "chai";
import { Component } from "types";
import { getComponentAbsolutePath, eachComponent } from "utils/formUtil";

xdescribe("getComponentAbsolutePath", () => {
it.only('should return the absolute path when iterating throught child components', () => {
const form = {
key: 'form',
display: 'form',
components: [
{
type: 'container',
key: 'outer-container',
components: [
{
type: 'textfield',
key: 'textfield',
},
{
type: 'container',
key: 'inner-container',
components: [
{
type: 'textfield',
key: 'innerTextfield',
}
]
}
]
}
],
}
// when passed child components, absolute path returns relative to the parent component/
eachComponent(form.components[0].components[1].components, (component: Component, path: string) => {
const absolutePath = getComponentAbsolutePath(component);

expect(absolutePath).to.equal('outer-container.inner-container.innerTextfield', 'absolute path path is incomplete');


});


});
});
Loading