-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,613 additions
and
90 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"require": [ | ||
"__tests__/init.js", | ||
"ts-node/register", | ||
"source-map-support/register", | ||
"__tests__/setup.test.ts" | ||
], | ||
"watch-extensions": ["ts"], | ||
"recursive": true, | ||
"reporter": "landing", | ||
"timeout": 5000 | ||
} |
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,49 @@ | ||
import { expect, test } from '@oclif/test' | ||
|
||
describe('scaffold:vapp', () => { | ||
test | ||
.stdout() | ||
.command(['scaffold']) | ||
.exit(2) | ||
.it('Running scaffold does nothing') | ||
|
||
test | ||
.stderr() | ||
.command(['scaffold:vapp']) | ||
.catch(ctx => { | ||
expect(ctx.message).to.contain('Missing required flag') | ||
}) | ||
.it('Running scaffold:vapp without a flags fails gracefully') | ||
|
||
test | ||
.stderr() | ||
.command(['scaffold:vapp', '--platforms']) | ||
.catch(ctx => { | ||
expect(ctx.message).to.contains('Flag --platforms expects a value') | ||
}) | ||
.it('Running scaffold:vapp without platform value fails gracefully') | ||
|
||
test | ||
.stderr() | ||
.command(['scaffold:vapp', '--backend']) | ||
.catch(ctx => { | ||
expect(ctx.message).to.contains('Flag --backend expects a value') | ||
}) | ||
.it('Running scaffold:vapp without backend value fails gracefully') | ||
|
||
test | ||
.stderr() | ||
.command(['scaffold:vapp', '--platforms=iOS']) | ||
.catch(ctx => { | ||
expect(ctx.message).to.contains('Missing required flag') | ||
}) | ||
.it('Running scaffold:vapp without backend flag fails gracefully') | ||
|
||
test | ||
.stderr() | ||
.command(['scaffold:vapp', '--backend=skip']) | ||
.catch(ctx => { | ||
expect(ctx.message).to.contains('Missing required flag') | ||
}) | ||
.it('Running scaffold:vapp without platform flag fails gracefully') | ||
}); |
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,2 @@ | ||
const path = require('path') | ||
process.env.TS_NODE_PROJECT = path.resolve('./__tests__/tsconfig.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,39 @@ | ||
import { mkdir, promises as fs } from 'fs'; | ||
const os = require('os'); | ||
|
||
export const appFileData = | ||
{ | ||
application_name: "Test App File", | ||
application_id: '1234-5678-abcd-efgh', | ||
private_key: "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQChMtZvvTVZltzi\nuv94cEW/McbLhiJCRvK+26o50JP4CDHtIiidrQiy1A6PdhXHXq7q+jYo9yrm9+mm\ngmYtTAtZ7ZVRDVOwuXoT71HXcFoRLedORx3Yp4J165uPO506nDvjvcURWLbLfCst\nsc2X189C31rCc4dPrmFkUoqtNWAoLsAjZJP7JfoGXR0V2mPeDwfWHqIlA+RgQ5ne\nc47CPWDxRVw9VKLre2BWX33N6iZ3fXkd/xobdTA/xjosGBz6sUIxnQSaW6YvLjZI\nJtNm5MfLehDGXXT3rmqOuxYLEHruibsrvGv/gxjnGEfa2JT38JRRU5rZCQoXeeXG\nhYm6zCExAgMBAAECggEAJUR7Fg9A18sMmzCPYplWTqsj4ibLIdaERYLEeqRRqUy/\nuiqlCDsaYTmsehdbVqH5v6KERflKxmY3cwL/u2Yy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rp38\nAU0Rmg0yVs7FXAxlOBcK0BOiUf8MhPBr9+uDh6X4wr2bSxdac3vSQUGFeA9CIWH7\nSI3z3A9Lp1aRaLucxTlJGq22\n-----END PRIVATE KEY-----\n" | ||
} | ||
|
||
export const cliConfigData = | ||
{ | ||
apiKey:"12345", | ||
apiSecret:"ABCDE" | ||
} | ||
|
||
export const cliConfigPath = `${os.homedir()}/.config/@vonage/cli-plugin-scaffold` | ||
|
||
export async function mochaGlobalSetup() { | ||
try { | ||
await fs.mkdir(cliConfigPath) | ||
await fs.writeFile(`${cliConfigPath}/vonage.config.json`, JSON.stringify(cliConfigData, null, 2)); | ||
await fs.writeFile('vonage_app.json', JSON.stringify(appFileData, null, 2)); | ||
console.log("Temp app file created"); | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} | ||
|
||
export async function mochaGlobalTeardown() { | ||
try { | ||
await fs.unlink(`${os.homedir()}/.config/@vonage/cli-plugin-scaffold/vonage.config.json`); | ||
await fs.rmdir(cliConfigPath); | ||
await fs.unlink('vonage_app.json'); | ||
console.log("Temp app file deleted"); | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
} |
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,11 @@ | ||
{ | ||
"declaration": false, | ||
"extends": "../tsconfig", | ||
"compilerOptions": { | ||
"sourceMap": true | ||
}, | ||
"include": [ | ||
"./**/*", | ||
"../src/**/*" | ||
] | ||
} |
Oops, something went wrong.