1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-08 23:25:51 +01:00

fix: husky commitlint not work, replace invalid test

This commit is contained in:
vip30 2019-03-09 21:00:47 +08:00
parent 1ab7c504ec
commit 84be869aaf
4 changed files with 50 additions and 7 deletions

@ -56,7 +56,7 @@
"@material-ui/core": "3.9.0",
"@material-ui/icons": "3.0.2",
"@verdaccio/babel-preset": "0.0.4",
"@verdaccio/types": "4.1.4",
"@verdaccio/types": "5.0.0-beta.3",
"autosuggest-highlight": "3.1.1",
"bundlesize": "0.17.1",
"codecov": "3.2.0",
@ -178,7 +178,8 @@
"preferGlobal": true,
"husky": {
"hooks": {
"pre-commit": "lint-staged && commitlint -e $GIT_PARAMS"
"pre-commit": "lint-staged",
"commit-msg": "commitlint -e $GIT_PARAMS"
}
},
"lint-staged": {

@ -46,3 +46,26 @@ exports[`Publish endpoints - publish package should change the existing package
],
}
`;
exports[`Publish endpoints - publish package should star a package 1`] = `
[MockFunction] {
"calls": Array [
Array [
"verdaccio",
Object {
"users": Object {
"verdaccio": true,
},
},
"15-e53a77096b0ee33e",
[Function],
],
],
"results": Array [
Object {
"type": "return",
"value": undefined,
},
],
}
`;

@ -254,11 +254,30 @@ describe('Publish endpoints - publish package', () => {
expect(next).toHaveBeenCalledWith(new Error(API_ERROR.BAD_PACKAGE_DATA));
});
test('should throw an error for un-implemented star calls', () => {
const storage = {};
req.body._rev = REVISION_MOCK;
req.body.users = {};
test('should star a package', () => {
const storage = {
changePackage: jest.fn(),
getPackage({ name, req, callback }) {
callback(null, {
users: {},
});
},
};
req = {
params: {
package: 'verdaccio',
},
body: {
_rev: REVISION_MOCK,
users: {
verdaccio: true,
},
},
remote_user: {
name: 'verdaccio',
},
};
publishPackage(storage)(req, res, next);
expect(next).toHaveBeenCalledWith(new Error('npm star| un-star calls are not implemented'));
expect(storage.changePackage).toMatchSnapshot();
});
});

BIN
yarn.lock

Binary file not shown.