1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-29 10:19:41 +02:00

chore(project): add prettier for code format (#3645)

* chore(project): install prettier and lint-staged

* chore(project): apply prettier to html too

* chore(project): git ignore eslintcache

* chore(project): add a comment about format script

* chore(prettier): update printWidth

* chore(prettier): remove useTabs option

* chore(prettier): add HTML validation

* refactor(prettier): fix closing tags

* feat(prettier): define angular parser for html templates

* style(prettier): run prettier on codebase

Co-authored-by: Anthony Lapenna <lapenna.anthony@gmail.com>
This commit is contained in:
Chaim Lev-Ari 2020-04-11 00:54:53 +03:00 committed by GitHub
parent 6663073be1
commit cf5056d9c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
714 changed files with 31228 additions and 28305 deletions

View file

@ -1,64 +1,63 @@
describe('VolumesController', function () {
var $scope, $httpBackend, $routeParams;
var $scope, $httpBackend, $routeParams;
beforeEach(module('portainer'));
beforeEach(inject(function (_$httpBackend_, $controller, _$routeParams_) {
$scope = {};
$httpBackend = _$httpBackend_;
$routeParams = _$routeParams_;
$controller('VolumesController', {
'$scope': $scope,
'$routeParams': $routeParams
});
}));
it('initializes correctly', function () {
expectGetVolumes();
$httpBackend.flush();
beforeEach(module('portainer'));
beforeEach(inject(function (_$httpBackend_, $controller, _$routeParams_) {
$scope = {};
$httpBackend = _$httpBackend_;
$routeParams = _$routeParams_;
$controller('VolumesController', {
$scope: $scope,
$routeParams: $routeParams,
});
}));
it('initializes correctly', function () {
expectGetVolumes();
$httpBackend.flush();
});
it('issues correct remove calls to the remote API', function () {
expectGetVolumes();
$httpBackend.flush();
$scope.volumes[0].Checked = true;
$scope.volumes[2].Checked = true;
$httpBackend.expectDELETE('dockerapi/volumes/tardis').respond(200);
$httpBackend.expectDELETE('dockerapi/volumes/bar').respond(200);
$scope.removeAction();
$httpBackend.flush();
it('issues correct remove calls to the remote API', function () {
expectGetVolumes();
$httpBackend.flush();
$scope.volumes[0].Checked = true;
$scope.volumes[2].Checked = true;
$httpBackend.expectDELETE('dockerapi/volumes/tardis').respond(200);
$httpBackend.expectDELETE('dockerapi/volumes/bar').respond(200);
$scope.removeAction();
$httpBackend.flush();
});
it('issues a correct volume creation call to the remote API', function () {
expectGetVolumes();
var createBody = {
Name: 'tardis',
Driver: 'local',
};
$httpBackend.expectPOST('dockerapi/volumes/create', createBody).respond(201);
expectGetVolumes();
$scope.addVolume(createBody);
$httpBackend.flush();
});
function expectGetVolumes() {
$httpBackend.expectGET('dockerapi/volumes').respond({
Volumes: [
{
Name: 'tardis',
Driver: 'local',
Mountpoint: '/var/lib/docker/volumes/tardis',
},
{
Name: 'foo',
Driver: 'local',
Mountpoint: '/var/lib/docker/volumes/foo',
},
{
Name: 'bar',
Driver: 'local',
Mountpoint: '/var/lib/docker/volumes/bar',
},
],
});
it('issues a correct volume creation call to the remote API', function () {
expectGetVolumes();
var createBody = {
"Name": "tardis",
"Driver": "local"
};
$httpBackend.expectPOST('dockerapi/volumes/create', createBody).respond(201);
expectGetVolumes();
$scope.addVolume(createBody);
$httpBackend.flush();
});
function expectGetVolumes() {
$httpBackend.expectGET('dockerapi/volumes').respond({
"Volumes": [
{
"Name": "tardis",
"Driver": "local",
"Mountpoint": "/var/lib/docker/volumes/tardis"
},
{
"Name": "foo",
"Driver": "local",
"Mountpoint": "/var/lib/docker/volumes/foo"
},
{
"Name": "bar",
"Driver": "local",
"Mountpoint": "/var/lib/docker/volumes/bar"
}
]
});
}
});
}
});