feat: modularisation (#244)
* chore: gitignore for lib directory * build: packageing for webpack lib build * build: webpack config * feat: expose App component with beeApiUrl parameter * build: tsconfig for library build * build: main property of package json for tsc build * refactor: rename beeUrl option to beeApiUrl * refactor: manange config class instead of process.env calls * build: babelrc config * build: babel plugins and presets for webpack build * chore: serve.js chmod * build(refactor): webpack build * refactor: number notation * chore: webpack and package config change * build: add babel preset-env * chore: prepare script also builds component lib * feat: typegen * revert: set back prepare command * build: assets loader config * feat: beeDebugApiUrl * refactor: move test files to the test folder because of typegen * feat: locked api settings * chore: depcheck ignores * chore: types check script * ci: check types * ci: publish with library * chore: add webpack as devDep * chore: locked semver * chore: remove debug logging * style: webpack config * chore: react and react-dom as dependency * chore: package-lock * fix: clean package-lock init * refactor: fix versions in package.json
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import { detectIndexHtml } from './file'
|
||||
|
||||
describe('file utils', () => {
|
||||
it('detectIndexHtml should find index.html', () => {
|
||||
expect(
|
||||
detectIndexHtml([
|
||||
{ name: 'swarm.png', path: 'swarm.png' },
|
||||
{ name: 'index.html', path: 'index.html' },
|
||||
]),
|
||||
).toBe('index.html')
|
||||
})
|
||||
|
||||
it('detectIndexHtml should find index.htm', () => {
|
||||
expect(
|
||||
detectIndexHtml([
|
||||
{ name: 'index.htm', path: 'index.htm' },
|
||||
{ name: 'swarm.png', path: 'swarm.png' },
|
||||
]),
|
||||
).toBe('index.htm')
|
||||
})
|
||||
|
||||
it('detectIndexHtml should find nested index.html', () => {
|
||||
expect(
|
||||
detectIndexHtml([
|
||||
{ name: 'swarm.png', path: 'sample-folder/swarm.png' },
|
||||
{ name: 'index.html', path: 'sample-folder/index.html' },
|
||||
]),
|
||||
).toBe('index.html')
|
||||
})
|
||||
|
||||
it('detectIndexHtml should not find nested index.htm when ambigous', () => {
|
||||
expect(
|
||||
detectIndexHtml([
|
||||
{ name: 'index.htm', path: 'sample-folder/index.htm' },
|
||||
{ name: 'swarm.png', path: 'other-folder/swarm.png' },
|
||||
]),
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('detectIndexHtml should not find deep index.html', () => {
|
||||
expect(
|
||||
detectIndexHtml([
|
||||
{ name: 'index.html', path: 'sample-folder/index.html' },
|
||||
{ name: 'swarm.png', path: 'swarm.png' },
|
||||
]),
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('detectIndexHtml should return false when no matches appear', () => {
|
||||
expect(
|
||||
detectIndexHtml([
|
||||
{ name: 'swarm.png', path: 'swarm.png' },
|
||||
{ name: 'swarm.jpg', path: 'swarm.jpg' },
|
||||
]),
|
||||
).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user