Skip to content

Commit

Permalink
Remove image-diff library and test on uploading profile picture
Browse files Browse the repository at this point in the history
  • Loading branch information
dilame committed Apr 2, 2019
1 parent 599badb commit c8026df
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 168 deletions.
116 changes: 0 additions & 116 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"dotenv": "^6.2.0",
"faker": "^3.1.0",
"gm": "^1.23.1",
"image-diff": "^1.6.3",
"inquirer": "^1.1.2",
"mkdirp": "^0.5.1",
"mocha": "^5.2.0",
Expand Down
51 changes: 0 additions & 51 deletions tests/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ const mkdirp = require('mkdirp');
const support = require('./support');
const _ = require('lodash');
const fs = require('fs');
const imageDiff = require('image-diff');
const rp = require('request-promise');
let session;
let credentials; // [username, password, proxy]

Expand Down Expand Up @@ -213,55 +211,6 @@ describe('Sessions', () => {
});
});

it('should not be problem to upload profile picture', done => {
const device = new Client.Device(credentials[0]);
const storage = new Client.CookieMemoryStorage();
const catPath = `${__dirname}/cat.jpg`;
const catTmpPath = `${__dirname}/tmp/downloaded.jpg`;
const promise = Client.Session.create(
device,
storage,
credentials[0],
credentials[1],
credentials[2],
);
promise
.then(sessionInstance => {
sessionInstance.should.be.instanceOf(Client.Session);
return Client.Account.setProfilePicture(session, catPath);
})
.then(account => {
account.should.be.instanceOf(Client.Account);
const picture = account.params.picture;
return [rp.get(picture, { encoding: 'binary' }), account];
})
.spread(picture => {
fs.writeFileSync(
`${__dirname}/tmp/downloaded.jpg`,
picture,
'binary',
);
return new Promise((res, rej) => {
imageDiff.getFullResult(
{
actualImage: catTmpPath,
expectedImage: catPath,
},
(err, diff) => {
if (err) return rej(err);
return res(diff);
},
);
});
})
.then(diff => {
diff.percentage.should.be.below(0.1);
done();
})
.catch(reason => {
done(reason);
});
});
});

describe('Feeds', () => {
Expand Down

0 comments on commit c8026df

Please sign in to comment.