Skip to content

Commit

Permalink
fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Dec 10, 2024
1 parent bad8ed4 commit 8c648e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/integration/api/backup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@ const { httpZipResponseToFiles } = require('../../util/zip');
describe('api: /backup', () => {
describe('POST', function () {
this.timeout(10000);

it('should reject if the user cannot backup', testService((service) =>
service.login('chelsea', (asChelsea) =>
asChelsea.post('/v1/backup').expect(403))));

it('should return a valid zip file if the user can backup @slow', testService((service) =>
service.login('alice', (asAlice) =>
httpZipResponseToFiles(asAlice.post('/v1/backup').expect(200))
.then(({ filenames, ...files }) => {
.then(({ filenames, files }) => {
const constantFiles = ['keepalive', 'keys.json', 'toc.dat'];
files.should.have.properties(constantFiles);
[ ...files.keys() ].should.eqlInAnyOrder(constantFiles);

const datFiles = without(constantFiles, filenames);
// Because /backup ALWAYS uses config('default.database'), this list
// may be empty in some environments, including CI.
datFiles.should.matchEvery(/\.dat\.gz$/);

const keysJson = JSON.parse(files['keys.json']);
const keysJson = JSON.parse(files.get('keys.json'));
keysJson.should.only.have.keys('iv', 'local', 'privkey', 'pubkey', 'salt');
keysJson.iv.should.be.a.String();
keysJson.privkey.should.be.a.String();
Expand Down

0 comments on commit 8c648e1

Please sign in to comment.