0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/test/functional/readme
Juan Picado @jotadeveloper 101fd78b0d
refactor: add constant file
starting with json headers common usage
2018-04-30 15:41:04 +02:00
..
pkg-readme.json refactor: unit test for readme, preserve tags on publish 2017-07-30 15:56:00 +00:00
readme.spec.js refactor: add constant file 2018-04-30 15:41:04 +02:00

import assert from 'assert';
import {HEADERS} from '../../../src/lib/constants';

export default function (server, server2) {

  describe('should test readme', () => {

    beforeAll(function() {
      return server.request({
        uri: '/readme-test',
        headers: {
          'content-type': HEADERS.JSON,
        },
        method: 'PUT',
        json: require('./pkg-readme.json'),
      }).status(201);
    });

    test('add pkg', () => {});

    describe('should check readme file', () => {
      const matchReadme = (serverRef) => {
        return serverRef.request({
          uri: '/-/verdaccio/package/readme/readme-test'
        }).status(200).then(function(body) {
          assert.equal(body, '<p>this is a readme</p>\n');
        });
      };

      test('server1 - readme', () => {
        return matchReadme(server);
      });

      test('server2 - readme', () => {
        return matchReadme(server2);
      });

    });
  });
}