Skip to content

Commit b429535

Browse files
authored
add pinpoint client smoke test (#194)
1 parent a7e6005 commit b429535

File tree

4 files changed

+125
-0
lines changed

4 files changed

+125
-0
lines changed

models/pinpoint/2016-12-01/smoke.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
{
3+
"version": 1,
4+
"defaultRegion": "us-west-2",
5+
"testCases": [
6+
{
7+
"operationName": "GetApps",
8+
"input": {},
9+
"errorExpectedFromService": false
10+
},
11+
{
12+
"operationName": "GetApp",
13+
"input": {
14+
"ApplicationId": "InvalidApplicationId"
15+
},
16+
"errorExpectedFromService": true
17+
}
18+
]
19+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Karma configuration
2+
process.env.CHROME_BIN = require('puppeteer').executablePath();
3+
4+
module.exports = function(config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', 'karma-typescript'],
8+
files: [
9+
'test/smoke/*.spec.ts',
10+
'commands/*.ts',
11+
'model/*.ts',
12+
'types/*.ts',
13+
'*.ts'
14+
],
15+
preprocessors: {
16+
'test/smoke/index.spec.ts': 'credentials',
17+
'**/*.ts': 'karma-typescript'
18+
},
19+
plugins: [
20+
'@aws-sdk/karma-credential-loader',
21+
'karma-chrome-launcher',
22+
'karma-coverage',
23+
'karma-jasmine',
24+
'karma-typescript'
25+
],
26+
reporters: ['progress', 'karma-typescript'],
27+
karmaTypescriptConfig: {
28+
tsconfig: './tsconfig.json',
29+
bundlerOptions: {
30+
addNodeGlobals: false
31+
}
32+
},
33+
port: 9876,
34+
colors: false,
35+
logLevel: config.LOG_INFO,
36+
autoWatch: false,
37+
browsers: ['ChromeHeadlessDisableCors'],
38+
customLaunchers: {
39+
ChromeHeadlessDisableCors: {
40+
base: 'ChromeHeadless',
41+
flags: ['--disable-web-security']
42+
}
43+
},
44+
singleRun: true,
45+
concurrency: Infinity,
46+
exclude: ['**/*.d.ts']
47+
});
48+
};

packages/client-pinpoint-browser/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@
4949
},
5050
"devDependencies": {
5151
"@aws-sdk/client-documentation-generator": "^0.1.0-preview.1",
52+
"@aws-sdk/karma-credential-loader": "^0.1.0-preview.2",
53+
"@types/jest": "^20.0.2",
54+
"jasmine-core": "^2.8.0",
55+
"jest": "^20.0.4",
56+
"karma": "^2.0.0",
57+
"karma-chrome-launcher": "^2.2.0",
58+
"karma-coverage": "^1.1.1",
59+
"karma-jasmine": "^1.1.1",
60+
"karma-typescript": "^3.0.12",
61+
"puppeteer": "^1.0.0",
5262
"rimraf": "^2.6.2",
5363
"typedoc": "^0.10.0",
5464
"typescript": "^3.0.0"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import {PinpointClient} from '../../PinpointClient';
2+
import {GetAppsCommand} from '../../commands/GetAppsCommand';
3+
import {GetAppCommand} from '../../commands/GetAppCommand';
4+
declare let defaultRegion: string;
5+
declare const credentials: any;
6+
describe('@aws-sdk/client-pinpoint-browser Smoke Tests:', () => {
7+
defaultRegion = defaultRegion || 'us-west-2';
8+
it('GetApps should succeed when given correct input', (done) => {
9+
const client = new PinpointClient({
10+
region: defaultRegion,
11+
credentials
12+
});
13+
14+
const getApps = new GetAppsCommand(
15+
{}
16+
);
17+
18+
client.send(getApps)
19+
.then((result) => {
20+
expect(typeof result).toBe('object');
21+
done();
22+
}).catch((err) => {
23+
expect(err).toBeUndefined();
24+
done();
25+
});
26+
});
27+
it('GetApp should fail when given bad input', (done) => {
28+
const client = new PinpointClient({
29+
region: defaultRegion,
30+
credentials
31+
});
32+
33+
const getApp = new GetAppCommand(
34+
{
35+
"ApplicationId": "InvalidApplicationId"
36+
}
37+
);
38+
39+
client.send(getApp)
40+
.then((result) => {
41+
expect(result).toBeUndefined();
42+
done();
43+
}).catch((err) => {
44+
expect(err).toBeDefined();
45+
done();
46+
});
47+
});
48+
});

0 commit comments

Comments
 (0)