mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
8434cc550f
* fix: logo loaded locally * chore: fix lint
50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import renderTemplate from '../../../../src/api/web/html/template';
|
|
|
|
const manifest = require('./partials/manifest/manifest.json');
|
|
|
|
const exampleManifest = {
|
|
css: ['main.css'],
|
|
js: ['runtime.js', 'main.js'],
|
|
ico: '/static/foo.ico',
|
|
};
|
|
|
|
describe('template', () => {
|
|
test('custom render', () => {
|
|
expect(renderTemplate({ options: { base: 'http://domain.com' }, manifest: exampleManifest }, manifest)).toMatchSnapshot();
|
|
});
|
|
|
|
test('custom title', () => {
|
|
expect(renderTemplate({ options: { base: 'http://domain.com', title: 'foo title' }, manifest: exampleManifest }, manifest)).toMatchSnapshot();
|
|
});
|
|
|
|
test('custom title', () => {
|
|
expect(renderTemplate({ options: { base: 'http://domain.com', title: 'foo title' }, manifest: exampleManifest }, manifest)).toMatchSnapshot();
|
|
});
|
|
|
|
test('custom logo', () => {
|
|
expect(renderTemplate({ options: { base: 'http://domain.com', logo: 'http://domain/logo.png' }, manifest: exampleManifest }, manifest)).toMatchSnapshot();
|
|
});
|
|
|
|
test('meta scripts', () => {
|
|
expect(
|
|
renderTemplate({ options: { base: 'http://domain.com' }, metaScripts: [`<style>.someclass{font-size:10px;}</style>`], manifest: exampleManifest }, manifest)
|
|
).toMatchSnapshot();
|
|
});
|
|
|
|
test('custom body after', () => {
|
|
expect(renderTemplate({ options: { base: 'http://domain.com' }, scriptsBodyAfter: [`<script src="foo"/>`], manifest: exampleManifest }, manifest)).toMatchSnapshot();
|
|
});
|
|
|
|
test('custom body before', () => {
|
|
expect(
|
|
renderTemplate(
|
|
{
|
|
options: { base: 'http://domain.com' },
|
|
scriptsbodyBefore: [`<script src="fooBefore"/>`, `<script src="barBefore"/>`],
|
|
manifest: exampleManifest,
|
|
},
|
|
manifest
|
|
)
|
|
).toMatchSnapshot();
|
|
});
|
|
});
|