Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('creates 3 AST chunks from the different types of dependencies', async () => {
const structure: ComponentStructure = {
chunks: [],
uidl: null,
options: {},
dependencies: {
package: componentDependency('package', 'npm-package', '1.0.0'),
library: componentDependency('library', 'project-lib', '2.0.0'),
local: componentDependency('local', '../../components/local'),
},
}
const { chunks } = await plugin(structure)
expect(chunks.length).toBe(3)
expect(chunks[0].name).toBe('test-lib')
expect(chunks[1].name).toBe('test-pack')
expect(chunks[2].name).toBe('test-local')
})
it('pushes chunks for imports even when no statement is needed', async () => {
const structure: ComponentStructure = {
chunks: [],
options: {},
uidl: null,
dependencies: {
local: componentDependency('local', '../../components/local'),
},
}
const { chunks } = await plugin(structure)
expect(chunks.length).toBe(3)
})
})
it('creates 3 AST chunks from the different types of dependencies', async () => {
const structure: ComponentStructure = {
chunks: [],
uidl: null,
options: {},
dependencies: {
package: componentDependency('package', 'npm-package', '1.0.0'),
library: componentDependency('library', 'project-lib', '2.0.0'),
local: componentDependency('local', '../../components/local'),
},
}
const { chunks } = await plugin(structure)
expect(chunks.length).toBe(3)
expect(chunks[0].name).toBe('test-lib')
expect(chunks[1].name).toBe('test-pack')
expect(chunks[2].name).toBe('test-local')
})
const uidl = (dependency) => {
return component(
'Component With Dependencies',
elementNode(
dependency.name,
{},
[],
componentDependency(dependency.type, dependency.path, dependency.version, dependency.option)
),
{},
{ title: definition('boolean', true) }
)
}
const uidl = (dependency) => {
return component(
'Component with dependencies',
elementNode(
dependency.name,
{},
[],
componentDependency(dependency.type, dependency.path, dependency.version, dependency.option)
),
{},
{ title: definition('boolean', true) }
)
}