Skip to content

Commit

Permalink
fix: husky commitlint not work, replace invalid test
Browse files Browse the repository at this point in the history
  • Loading branch information
vip30 committed Mar 9, 2019
1 parent 1ab7c50 commit 84be869
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 11 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
23 changes: 23 additions & 0 deletions test/unit/api/__snapshots__/api.publish.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
],
}
`;
29 changes: 24 additions & 5 deletions test/unit/api/api.publish.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1372,10 +1372,10 @@
resolved "https://registry.verdaccio.org/@verdaccio%2fstreams/-/streams-2.0.0-beta.0.tgz#af8c7e673a3c368deacc8024c6f5671aa2ec32ac"
integrity sha512-EdVF6RP0abRNT0RfgLCsqLNv7FOpm+BpzMZoaQuQGHSBQRj7OTM8ft5mpbJ40rYVXKv6D8xyU0vUnoRl09ah6g==

"@verdaccio/types@4.1.4":
version "4.1.4"
resolved "https://registry.verdaccio.org/@verdaccio%2ftypes/-/types-4.1.4.tgz#6144410b9fd63d916aa279378a4946c701a82586"
integrity sha512-0kNIQvMakoHIk1dpgnXVgQ5qwxJGTtMpJkLZKiN5WpLi5yuQtjc+kD/0EWDV4164pKg1KUU6YFLpbcXWxR8zvQ==
"@verdaccio/types@5.0.0-beta.3":
version "5.0.0-beta.3"
resolved "https://registry.npmjs.org/@verdaccio/types/-/types-5.0.0-beta.3.tgz#f6c9fd31a40b2be96fe080c49d7f4a1239413318"
integrity sha512-qPwE0bjDhXXVK7Gwg0O6RargAE7/AseVcZhcZEnf25RAra5ZL3MiM0dUUlierMc9XcPVjVHwTasAnF54Qmz9bg==

"@webassemblyjs/[email protected]":
version "1.7.8"
Expand Down

0 comments on commit 84be869

Please sign in to comment.