Skip to content

Commit

Permalink
Fetch file data in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaehring committed Feb 24, 2023
1 parent 365a52e commit 98d2b39
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/client/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ describe.skip('file', function () {
};
let fileId;
const filename = 'node_file_test.txt';
const files = { file: [{ data: '#noop\n', filename }] };
const data = '#noop\n';
const files = { file: [{ data, filename }] };
it('sends a file with a log', () => session()
.then(() => farm.log.send('observation', log, { files }))
.then((response) => {
Expand All @@ -29,6 +30,12 @@ describe.skip('file', function () {
const file = response.data.data[0];
expect(file).to.have.property('id', fileId);
expect(file).to.have.nested.property('attributes.filename', filename);
expect(file).to.have.nested.property('attributes.uri.url').that.is.a('string');
const { attributes: { uri: { url } } } = file;
return farm.request({ url, responseType: 'text' });
})
.then((response) => {
expect(response).to.have.property('data', data);
return farm.log.delete('observation', log.id);
})
.then(() => farm.log.fetch('observation', { filter: { id: log.id } }))
Expand Down

0 comments on commit 98d2b39

Please sign in to comment.