This repository has been archived by the owner on May 14, 2021. It is now read-only.
forked from goya/pgb-cli
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support for ignore flag (fix for #10)
- Loading branch information
Showing
14 changed files
with
67 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
const app = require('../../../src/commands/helpers/app.js') | ||
const fs = require('fs') | ||
|
||
describe('app', () => { | ||
beforeEach(() => { | ||
global.pgb = { opts: { variables: {} } } | ||
}) | ||
|
||
test('should format platforms', () => { | ||
test('should be a function', () => { | ||
expect(app.getData).toBeInstanceOf(Function) | ||
}) | ||
|
||
test('should return empty object with no variables', () => | ||
expect(app.getData()).toEqual({ keys: {} }) | ||
expect(app.getData()).toEqual({ keys: {}, ignore: [] }) | ||
) | ||
|
||
test('should not fail if config file not found', () => | ||
expect(app.getData('not_found')).toEqual({ keys: {}, ignore: [] }) | ||
) | ||
|
||
test('should throw error on bad json', () => { | ||
fs.writeFileSync('/.pgbrc', 'not json') | ||
expect(() => app.getData('/')).toThrow('invalid json in .pgbrc file') | ||
}) | ||
|
||
test('should get variables from file', () => { | ||
fs.writeFileSync('/.pgbrc', '{ "private": true }') | ||
expect(app.getData('/')).toEqual({ 'ignore': [], 'keys': {}, 'private': true }) | ||
}) | ||
|
||
test('should attach whitelisted variables to object', () => { | ||
global.pgb.opts.variables = { share: true, foo: 'bar', 'android-key': 12 } | ||
expect(app.getData()).toEqual({ share: true, keys: { android: 12 } }) | ||
global.pgb.opts.variables = { share: true, foo: 'bar', 'android-key': 12, ignore: [ 'node_modules' ] } | ||
expect(app.getData()).toEqual({ share: true, keys: { android: 12 }, ignore: [ 'node_modules' ] }) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters