Skip to content

Commit

Permalink
test: exclude fs for browser scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
Joy Chang committed May 7, 2019
1 parent 9af4567 commit 0c5b534
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/unit/readCredentialsFile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ const readCredentialsFunctions = require('../../lib/read-credentials-file');
const constructFilepath = readCredentialsFunctions.constructFilepath;
const fileExistsAtPath = readCredentialsFunctions.fileExistsAtPath;
const readCredentialsFile = readCredentialsFunctions.readCredentialsFile;
const fs = require('fs');

describe('browser scenario', () => {
const existSync = fs.existsSync;
beforeAll(() => {
fs.existsSync = undefined;
});

it('should return empty object when webpack override fs with empty object', () => {
const cred = readCredentialsFile();
expect(cred).toEqual({});
});

afterAll(() => {
fs.existsSync = existSync;
});
});

describe('read ibm credentials file', () => {
const locationOfActualFile = __dirname + '/../resources';
Expand Down

0 comments on commit 0c5b534

Please sign in to comment.