Skip to content

Commit

Permalink
test: fix breaking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jan 4, 2024
1 parent 53192ce commit 323c89a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
6 changes: 0 additions & 6 deletions tests/linker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,13 @@ test.group('Views Linker | .edge', () => {
"colStart": 13,
"line": 0,
},
{
"colEnd": 21,
"colStart": 9,
"line": 5,
},
]
`)

const paths = result.map((r) => r.templatePath)

assert.sameDeepMembers(paths, [
slash(join(fs.basePath, 'resources/views/components/button.edge')),
slash(join(fs.basePath, 'resources/views/layouts/base.edge')),
])
})

Expand Down
42 changes: 27 additions & 15 deletions tests/template_indexer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ test.group('Template indexer | Scan', () => {
disk: 'default',
isComponent: true,
componentName: 'button',
selfClosedInsertText: `button(\${1})`,
insertText: `button(\${1}) \n\t$0\n@end`,
},
{
path: slash(join(fs.basePath, 'resources/views/layouts/base.edge')),
name: 'layouts/base',
disk: 'default',
isComponent: false,
componentName: null,
selfClosedInsertText: `null(\${1})`,
insertText: `null(\${1}) \n\t$0\n@end`,
},
])
})
Expand All @@ -42,7 +46,7 @@ test.group('Template indexer | Scan', () => {

const indexer = new TemplateIndexer({
rootPath: fs.basePath,
disks: { default: 'resources/views', dimerr: '@dimer' },
disks: { default: 'resources/views', dimer: '@dimer' },
})

const result = await indexer.scan()
Expand All @@ -54,27 +58,35 @@ test.group('Template indexer | Scan', () => {
disk: 'default',
isComponent: true,
componentName: 'button',
selfClosedInsertText: `button(\${1})`,
insertText: `button(\${1}) \n\t$0\n@end`,
},
{
path: slash(join(fs.basePath, 'resources/views/layouts/base.edge')),
name: 'layouts/base',
disk: 'default',
isComponent: false,
componentName: null,
selfClosedInsertText: `null(\${1})`,
insertText: `null(\${1}) \n\t$0\n@end`,
},
{
path: slash(join(fs.basePath, 'node_modules/@dimer/components/foo.edge')),
name: 'dimerr::components/foo',
disk: 'dimerr',
name: 'dimer::components/foo',
disk: 'dimer',
isComponent: true,
componentName: 'dimerr.foo',
componentName: 'dimer.foo',
selfClosedInsertText: `dimer.foo(\${1})`,
insertText: `dimer.foo(\${1}) \n\t$0\n@end`,
},
{
path: slash(join(fs.basePath, 'node_modules/@dimer/layouts/foo.edge')),
name: 'dimerr::layouts/foo',
disk: 'dimerr',
name: 'dimer::layouts/foo',
disk: 'dimer',
isComponent: false,
componentName: null,
selfClosedInsertText: `null(\${1})`,
insertText: `null(\${1}) \n\t$0\n@end`,
},
])
})
Expand Down Expand Up @@ -115,7 +127,7 @@ test.group('Template indexer | Scan', () => {

const result = await indexer.scan()

assert.includeDeepMembers(result, [
assert.containsSubset(result, [
{
path: slash(join(fs.basePath, 'resources/views/components/button.edge')),
name: 'components/button',
Expand Down Expand Up @@ -153,23 +165,23 @@ test.group('Template indexer | Scan', () => {

const indexer = new TemplateIndexer({
rootPath: fs.basePath,
disks: { default: 'resources/views', dimerr: '@dimer' },
disks: { default: 'resources/views', dimer: '@dimer' },
})

const result = await indexer.scan()

assert.includeDeepMembers(result, [
assert.containsSubset(result, [
{
path: slash(join(fs.basePath, 'node_modules/@dimer/components/foo.edge')),
name: 'dimerr::components/foo',
disk: 'dimerr',
name: 'dimer::components/foo',
disk: 'dimer',
isComponent: true,
componentName: 'dimerr.foo',
componentName: 'dimer.foo',
},
{
path: slash(join(fs.basePath, 'node_modules/@dimer/layouts/foo.edge')),
name: 'dimerr::layouts/foo',
disk: 'dimerr',
name: 'dimer::layouts/foo',
disk: 'dimer',
isComponent: false,
componentName: null,
},
Expand All @@ -189,7 +201,7 @@ test.group('Template indexer | Scan', () => {
})

const result = await indexer.scan()
assert.includeDeepMembers(result, [
assert.containsSubset(result, [
{
path: slash(join(fs.basePath, 'resources/views/components/button/index.edge')),
name: 'components/button/index',
Expand Down

0 comments on commit 323c89a

Please sign in to comment.