UNPKG

@zkochan/pnpm

Version:

A fast implementation of npm install

56 lines (52 loc) 1.24 kB
const indexify = require('../lib/indexify') describe('indexify', function () { const toc = { sections: [ { title: 'Readme', url: 'index.html', source: 'README.md', slug: 'index' }, { title: 'Getting Started', sections: [ { title: 'Install', url: 'install.html', source: 'docs/install.md', slug: 'install' }, { title: 'Usage', url: 'usage.html', source: 'docs/usage.md', slug: 'usage' } ] } ] } it('index works', function () { const res = indexify(toc) expect(res.index).toEqual({ 'install.html': { source: 'docs/install.md', title: 'Install', slug: 'install' }, 'usage.html': { source: 'docs/usage.md', title: 'Usage', slug: 'usage' }, 'index.html': { source: 'README.md', title: 'Readme', slug: 'index' } }) }) it('sources works', function () { const res = indexify(toc) expect(res.sources).toEqual({ 'docs/install.md': 'install.html', 'docs/usage.md': 'usage.html', 'README.md': 'index.html' }) }) })