mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 03:06:38 +00:00
Merge pull request #2161 from resin-io/local-test-blobs
test(image-stream): Use local dir instead of tmpdir
This commit is contained in:
commit
8bb20de912
3
.gitignore
vendored
3
.gitignore
vendored
@ -11,6 +11,9 @@ pids
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
/lib-cov
|
||||
|
||||
# Image stream output directory
|
||||
/tests/image-stream/output
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
/coverage
|
||||
|
||||
|
@ -20,7 +20,6 @@ const m = require('mochainon')
|
||||
const _ = require('lodash')
|
||||
const Bluebird = require('bluebird')
|
||||
const fs = Bluebird.promisifyAll(require('fs'))
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const imageStream = require('../../lib/sdk/image-stream/index')
|
||||
|
||||
@ -51,9 +50,15 @@ exports.expectError = function (file, errorMessage, errorDetail) {
|
||||
|
||||
exports.extractFromFilePath = function (file, image) {
|
||||
it('should be able to extract the image', function () {
|
||||
const output = path.join(os.tmpdir(), path.basename(file))
|
||||
const dirname = path.join(__dirname, 'output')
|
||||
const output = path.join(dirname, path.basename(file))
|
||||
|
||||
return imageStream.getFromFilePath(file).then(function (results) {
|
||||
return fs.mkdirAsync(dirname)
|
||||
.catch({ code: 'EEXIST' }, _.noop)
|
||||
.then(function () {
|
||||
return imageStream.getFromFilePath(file)
|
||||
})
|
||||
.then(function (results) {
|
||||
m.chai.expect(results.path).to.equal(file)
|
||||
m.chai.expect(_.isString(results.extension)).to.be.true
|
||||
m.chai.expect(_.isEmpty(_.trim(results.extension))).to.be.false
|
||||
|
Loading…
x
Reference in New Issue
Block a user