mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 17:31:36 -06:00
skip some tests (for now) on windows (#57)
This commit is contained in:
parent
1047a26f15
commit
4c7a547f26
@ -4,6 +4,8 @@ const path = require('path');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
|
||||||
|
const { isMac } = require('../js/utils/misc.js')
|
||||||
|
|
||||||
const snippetBase64 = require('./fixtures/snippet/snippet-base64.js');
|
const snippetBase64 = require('./fixtures/snippet/snippet-base64.js');
|
||||||
|
|
||||||
// mock child_process used in ScreenSnippet
|
// mock child_process used in ScreenSnippet
|
||||||
@ -52,16 +54,20 @@ function createTestFile(done) {
|
|||||||
|
|
||||||
describe('Tests for ScreenSnippet', function() {
|
describe('Tests for ScreenSnippet', function() {
|
||||||
describe('when reading a valid jpeg file', function() {
|
describe('when reading a valid jpeg file', function() {
|
||||||
it('should match base64 output', function(done) {
|
|
||||||
let s = new ScreenSnippet();
|
|
||||||
s.capture().then(gotImage);
|
|
||||||
|
|
||||||
function gotImage(rsp) {
|
// skip test for windows - until feature is supported
|
||||||
expect(rsp.type).toEqual('image/jpg;base64');
|
if (isMac) {
|
||||||
expect(rsp.data).toEqual(snippetBase64);
|
it('should match base64 output', function(done) {
|
||||||
done();
|
let s = new ScreenSnippet();
|
||||||
};
|
s.capture().then(gotImage);
|
||||||
});
|
|
||||||
|
function gotImage(rsp) {
|
||||||
|
expect(rsp.type).toEqual('image/jpg;base64');
|
||||||
|
expect(rsp.data).toEqual(snippetBase64);
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
it('should remove output file after completed', function(done) {
|
it('should remove output file after completed', function(done) {
|
||||||
createTestFile(function(testfileName) {
|
createTestFile(function(testfileName) {
|
||||||
@ -97,32 +103,35 @@ describe('Tests for ScreenSnippet', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail if read file fails', function(done) {
|
// skip test for windows - until feature is supported
|
||||||
var origFsReadFile = fs.readFile;
|
if (isMac) {
|
||||||
|
it('should fail if read file fails', function(done) {
|
||||||
|
var origFsReadFile = fs.readFile;
|
||||||
|
|
||||||
fs.readFile = jest.fn(mockedReadFile);
|
fs.readFile = jest.fn(mockedReadFile);
|
||||||
|
|
||||||
function mockedReadFile(filename, callback) {
|
function mockedReadFile(filename, callback) {
|
||||||
callback(new Error('failed'));
|
callback(new Error('failed'));
|
||||||
}
|
}
|
||||||
|
|
||||||
let s = new ScreenSnippet();
|
let s = new ScreenSnippet();
|
||||||
s.capture().then(resolved).catch(rejected);
|
s.capture().then(resolved).catch(rejected);
|
||||||
|
|
||||||
function resolved(err) {
|
function resolved(err) {
|
||||||
cleanup();
|
cleanup();
|
||||||
// shouldn't get here
|
// shouldn't get here
|
||||||
expect(true).toBe(false);
|
expect(true).toBe(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function rejected(err) {
|
function rejected(err) {
|
||||||
expect(err).toBeTruthy();
|
expect(err).toBeTruthy();
|
||||||
cleanup();
|
cleanup();
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
fs.readFile = origFsReadFile;
|
fs.readFile = origFsReadFile;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user