-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Zcli package ignore" (#144)"
This reverts commit 625ca70.
- Loading branch information
Showing
14 changed files
with
108 additions
and
11 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ yarn-error.log | |
.vscode | ||
packages/zcli-apps/tests/functional/mocks/*/tmp | ||
packages/**/dist | ||
.DS_Store |
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
6 changes: 6 additions & 0 deletions
6
packages/zcli-apps/tests/functional/mocks/single_product_ignore/.zcliignore
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
assets/logo-small.png | ||
assets/iframe.html | ||
assets/icon_nav_bar.svg | ||
manifest.json | ||
testFolder/ignoreFolder | ||
testFolder/1gn0r3m3.jpg |
Binary file added
BIN
+9.02 KB
.../zcli-apps/tests/functional/mocks/single_product_ignore/assets/icon_nav_bar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
packages/zcli-apps/tests/functional/mocks/single_product_ignore/assets/iframe.html
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
app 1 Iframe |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions
18
packages/zcli-apps/tests/functional/mocks/single_product_ignore/manifest.json
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "Test App 1", | ||
"author": { | ||
"name": "Zendesk", | ||
"email": "[email protected]", | ||
"url": "https://help.zendesk.com" | ||
}, | ||
"defaultLocale": "en", | ||
"private": true, | ||
"location": { | ||
"support": { | ||
"ticket_editor": "assets/iframe.html", | ||
"nav_bar": "assets/iframe.html" | ||
} | ||
}, | ||
"version": "1.0", | ||
"frameworkVersion": "2.0" | ||
} |
1 change: 1 addition & 0 deletions
1
packages/zcli-apps/tests/functional/mocks/single_product_ignore/zcli.apps.config.json
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"app_id":123456} |
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,5 +1,8 @@ | ||
import { expect, test } from '@oclif/test' | ||
import * as path from 'path' | ||
import * as fs from 'fs' | ||
import * as readline from 'readline' | ||
import * as AdmZip from 'adm-zip' | ||
|
||
describe('package', function () { | ||
const appPath = path.join(__dirname, 'mocks/single_product_app') | ||
|
@@ -16,7 +19,7 @@ describe('package', function () { | |
}) | ||
.stdout() | ||
.command(['apps:package', appPath]) | ||
.it('should display success message package is created', ctx => { | ||
.it('should display success message if package is created', ctx => { | ||
const pkgPath = path.join(path.relative(process.cwd(), appPath), 'tmp', 'app') | ||
expect(ctx.stdout).to.contain(`Package created at ${pkgPath}`) | ||
}) | ||
|
@@ -36,3 +39,53 @@ describe('package', function () { | |
.catch(err => expect(err.message).to.contain('Error: invalid location')) | ||
.it('should display error message if package fails to create') | ||
}) | ||
|
||
describe('zcliignore', function () { | ||
const appPath = path.join(__dirname, 'mocks/single_product_ignore') | ||
const tmpPath = path.join(appPath, 'tmp') | ||
|
||
const file = readline.createInterface({ | ||
input: fs.createReadStream(path.join(appPath, '.zcliignore')), | ||
output: process.stdout, | ||
terminal: false | ||
}) | ||
|
||
const ignoreArr: string[] = [] // array that holds each line of the .ignore file | ||
|
||
file.on('line', (line) => { | ||
ignoreArr.push(line) // add to array dynamically | ||
}) | ||
|
||
after(async () => { | ||
fs.readdir(tmpPath, (err, files) => { | ||
if (err) throw err | ||
|
||
for (const file of files) { | ||
fs.unlink(path.join(tmpPath, file), (err) => { | ||
if (err) throw err | ||
}) | ||
} | ||
}) | ||
}) | ||
|
||
test | ||
.env({ | ||
ZENDESK_SUBDOMAIN: 'z3ntest', | ||
ZENDESK_EMAIL: '[email protected]', | ||
ZENDESK_PASSWORD: '123456' // the universal password | ||
}) | ||
.nock('https://z3ntest.zendesk.com', api => { | ||
api | ||
.post('/api/v2/apps/validate') | ||
.reply(200) | ||
}) | ||
.stdout() | ||
.command(['apps:package', appPath]) | ||
.it('should not include certain files as specified in .zcliignore', async () => { | ||
const packagePath = path.join(tmpPath, (fs.readdirSync(tmpPath).find(fn => fn.startsWith('app'))) + '') | ||
const zip = new AdmZip(packagePath) | ||
for (const zipEntry of zip.getEntries()) { | ||
expect(ignoreArr.includes(zipEntry.name)).to.eq(false) | ||
} | ||
}) | ||
}) |
Binary file not shown.
Binary file not shown.