Skip to content

Instantly share code, notes, and snippets.

@niftydevelopment
Created June 27, 2016 15:02
Show Gist options
  • Save niftydevelopment/916f2cf1ae9e758f7467727f0d1e112c to your computer and use it in GitHub Desktop.
Save niftydevelopment/916f2cf1ae9e758f7467727f0d1e112c to your computer and use it in GitHub Desktop.
describe('Kopiera kontrollpunkter mellan ett Sammanställt Kontrollpunktsresultat och ett nytt Kontrollunderlag.', function () {
var http, $rootScope, sut, tester;
describe('Från källa', function () {
beforeEach(function () {
tester = ngMidwayTester('atlas.services');
sut = tester.inject('KontrollprotokollService');
http = tester.inject('$http');
});
beforeEach(function (done) {
done();
}, 1000);
afterEach(function () {
tester.destroy();
tester = null;
});
it('FältärendeService skall finnas', function () {
expect(sut).toBeDefined();
});
it('skall returnera underlaget 1', function (done) {
//http://localhost:9000/local/integration-test/giltig_urval_fil.xlsx
http({method: 'GET',
url: '/integration-test/giltig_urval_fil.xlsx',
headers: {
'Content-type': 'application/json'
},
responseType: 'arraybuffer'
}).then(function(xlsx) {
//var blob = new Blob([xls], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
console.debug('xlsx', xlsx);
var formData = new FormData();
formData.append("data", angular.toJson(xlsx));
http.post({
url: '/atlas/rest/test/importeraurval?reloadtestdata=false&lan=F',
headers: { 'Content-Type': false },
data: { data: data }
}).then(function(result) {
console.debug('posted', result);
}, function(error) {
console.debug('posted', error);
});
}, function(error) {
console.debug('get xlsx', error);
});
var result = sut.getProtokollPresentation(1, 2).then(function(result) {
expect(result.kontrollobjektById[28801].kontrollpunktByKod["00039"]).toBeDefined();
done();
});
console.debug(result);
})
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment