Skip to content

Commit 18f04d1

Browse files
SwaySwayyuth
SwaySway
authored andcommitted
style: run prettier through code
1 parent 6481db0 commit 18f04d1

File tree

474 files changed

+48425
-44236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

474 files changed

+48425
-44236
lines changed

commitlint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['@commitlint/config-lerna-scopes', '@commitlint/config-conventional']
2+
extends: ['@commitlint/config-lerna-scopes', '@commitlint/config-conventional'],
33
};

cypress/integration/api_spec.js

+20-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
21
describe('API test post and get', function() {
3-
beforeEach(function() {
4-
cy.visit('/')
5-
})
6-
7-
it('successfully adds data to dynamodb', function() {
8-
// Check for user not signed up
9-
cy.get('input[name=itemNo]').type('1')
10-
cy.get('.amplify-submit-put-button').contains('Put').click()
11-
cy.get('.amplify-put-result').contains('post call succeed!')
12-
})
2+
beforeEach(function() {
3+
cy.visit('/');
4+
});
5+
6+
it('successfully adds data to dynamodb', function() {
7+
// Check for user not signed up
8+
cy.get('input[name=itemNo]').type('1');
9+
cy.get('.amplify-submit-put-button')
10+
.contains('Put')
11+
.click();
12+
cy.get('.amplify-put-result').contains('post call succeed!');
13+
});
1314

14-
it('successfully get data from dynamodb', function() {
15-
// Check for user not signed up
16-
cy.get('.amplify-submit-get-button').contains('Get').click()
17-
cy.get('.amplify-get-result').contains('"itemNo":1')
18-
})
19-
})
15+
it('successfully get data from dynamodb', function() {
16+
// Check for user not signed up
17+
cy.get('.amplify-submit-get-button')
18+
.contains('Get')
19+
.click();
20+
cy.get('.amplify-get-result').contains('"itemNo":1');
21+
});
22+
});

cypress/integration/auth_spec.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
21
describe('withAuthenticator Sign In', function() {
32
beforeEach(function() {
4-
cy.visit('/')
5-
})
3+
cy.visit('/');
4+
});
65

76
it('throws error when user is not signed up', function() {
87
// Check for user not signed up
9-
cy.get('input[name=username]').type('testuser')
10-
cy.get('input[name=password]').type('testPassword')
11-
cy.get('button').contains('Sign In').click()
12-
cy.get('div').contains('User does not exist')
13-
})
14-
})
15-
8+
cy.get('input[name=username]').type('testuser');
9+
cy.get('input[name=password]').type('testPassword');
10+
cy.get('button')
11+
.contains('Sign In')
12+
.click();
13+
cy.get('div').contains('User does not exist');
14+
});
15+
});

cypress/plugins/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
module.exports = (on, config) => {
1515
// `on` is used to hook into various events Cypress emits
1616
// `config` is the resolved Cypress config
17-
}
17+
};

cypress/support/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// ***********************************************************
1515

1616
// Import commands.js using ES2015 syntax:
17-
import './commands'
17+
import './commands';
1818

1919
// Alternatively you can use CommonJS syntax:
2020
// require('./commands')

packages/amplify-appsync-simulator/src/__tests__/velocity/util/time.test.ts

+18-46
Original file line numberDiff line numberDiff line change
@@ -37,47 +37,25 @@ describe('Velocity $context.util.time', () => {
3737
});
3838

3939
it('parseFormattedToEpochMilliSeconds', () => {
40-
expect(
41-
time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_UTC, FORMAT_CUSTOM_ZONED)
42-
).toEqual(TEST_TIMESTAMP_MILLIS);
43-
expect(
44-
time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_PLUS8, FORMAT_CUSTOM_ZONED)
45-
).toEqual(TEST_TIMESTAMP_MILLIS);
46-
expect(
47-
time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_UTC, FORMAT_CUSTOM_ZONED)
48-
).toEqual(TEST_TIMESTAMP_MILLIS);
49-
expect(
50-
time.parseFormattedToEpochMilliSeconds(
51-
TEST_TIMESTAMP_CUSTOM_PLUS8,
52-
FORMAT_CUSTOM_ZONED,
53-
'Australia/Perth'
54-
)
55-
).toEqual(TEST_TIMESTAMP_MILLIS);
56-
expect(
57-
time.parseFormattedToEpochMilliSeconds(
58-
TEST_TIMESTAMP_CUSTOM_UTC_UNZONED,
59-
FORMAT_CUSTOM_UNZONED,
60-
'UTC'
61-
)
62-
).toEqual(TEST_TIMESTAMP_MILLIS);
63-
64-
expect(
65-
time.parseFormattedToEpochMilliSeconds(
66-
TEST_TIMESTAMP_CUSTOM_PLUS8_UNZONED,
67-
FORMAT_CUSTOM_UNZONED,
68-
'Australia/Perth'
69-
)
70-
).toEqual(TEST_TIMESTAMP_MILLIS);
71-
});
72-
73-
it('parseISO8601ToEpochMilliSeconds', () => {
74-
expect(time.parseISO8601ToEpochMilliSeconds(TEST_TIMESTAMP_ZULU)).toEqual(
40+
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_UTC, FORMAT_CUSTOM_ZONED)).toEqual(TEST_TIMESTAMP_MILLIS);
41+
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_PLUS8, FORMAT_CUSTOM_ZONED)).toEqual(TEST_TIMESTAMP_MILLIS);
42+
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_UTC, FORMAT_CUSTOM_ZONED)).toEqual(TEST_TIMESTAMP_MILLIS);
43+
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_PLUS8, FORMAT_CUSTOM_ZONED, 'Australia/Perth')).toEqual(
44+
TEST_TIMESTAMP_MILLIS
45+
);
46+
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_UTC_UNZONED, FORMAT_CUSTOM_UNZONED, 'UTC')).toEqual(
7547
TEST_TIMESTAMP_MILLIS
7648
);
77-
expect(time.parseISO8601ToEpochMilliSeconds(TEST_TIMESTAMP_PLUS8)).toEqual(
49+
50+
expect(time.parseFormattedToEpochMilliSeconds(TEST_TIMESTAMP_CUSTOM_PLUS8_UNZONED, FORMAT_CUSTOM_UNZONED, 'Australia/Perth')).toEqual(
7851
TEST_TIMESTAMP_MILLIS
7952
);
8053
});
54+
55+
it('parseISO8601ToEpochMilliSeconds', () => {
56+
expect(time.parseISO8601ToEpochMilliSeconds(TEST_TIMESTAMP_ZULU)).toEqual(TEST_TIMESTAMP_MILLIS);
57+
expect(time.parseISO8601ToEpochMilliSeconds(TEST_TIMESTAMP_PLUS8)).toEqual(TEST_TIMESTAMP_MILLIS);
58+
});
8159
it('epochMilliSecondsToSeconds', () => {
8260
expect(time.epochMilliSecondsToSeconds(TEST_TIMESTAMP_MILLIS)).toEqual(TEST_TIMESTAMP_SECS);
8361
});
@@ -86,16 +64,10 @@ describe('Velocity $context.util.time', () => {
8664
});
8765

8866
it('epochMilliSecondsToFormatted', () => {
89-
expect(time.epochMilliSecondsToFormatted(TEST_TIMESTAMP_MILLIS, FORMAT_CUSTOM_ZONED)).toEqual(
90-
TEST_TIMESTAMP_CUSTOM_UTC
91-
);
67+
expect(time.epochMilliSecondsToFormatted(TEST_TIMESTAMP_MILLIS, FORMAT_CUSTOM_ZONED)).toEqual(TEST_TIMESTAMP_CUSTOM_UTC);
9268

93-
expect(
94-
time.epochMilliSecondsToFormatted(
95-
TEST_TIMESTAMP_MILLIS,
96-
FORMAT_CUSTOM_ZONED,
97-
'Australia/Perth'
98-
)
99-
).toEqual(TEST_TIMESTAMP_CUSTOM_PLUS8);
69+
expect(time.epochMilliSecondsToFormatted(TEST_TIMESTAMP_MILLIS, FORMAT_CUSTOM_ZONED, 'Australia/Perth')).toEqual(
70+
TEST_TIMESTAMP_CUSTOM_PLUS8
71+
);
10072
});
10173
});

packages/amplify-appsync-simulator/src/__tests__/velocity/value-mapper/map.test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ describe('JavaMap', () => {
3636
it('entrySet', () => {
3737
const obj = { foo: 'Foo Value', bar: 'Bar Value' };
3838
const map = new JavaMap(obj, identityMapper);
39-
expect(map.entrySet().toJSON()).toEqual([
40-
{ key: 'foo', value: 'Foo Value' },
41-
{ key: 'bar', value: 'Bar Value' },
42-
]);
39+
expect(map.entrySet().toJSON()).toEqual([{ key: 'foo', value: 'Foo Value' }, { key: 'bar', value: 'Bar Value' }]);
4340
});
4441

4542
it('equal', () => {

packages/amplify-appsync-simulator/src/__tests__/velocity/value-mapper/string.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { JavaString } from '../../../velocity/value-mapper/string';
22

33
describe('JavaString', () => {
44
it('replaceAll', () => {
5-
const str = new JavaString('foo bar foo bar foo bar Foo')
5+
const str = new JavaString('foo bar foo bar foo bar Foo');
66
const replacedStr = str.replaceAll('foo', 'baz');
77
expect(replacedStr.toString()).toEqual('baz bar baz bar baz bar Foo');
88
expect(replacedStr.toIdString()).toEqual('baz bar baz bar baz bar Foo');
99
expect(replacedStr.toJSON()).toEqual('baz bar baz bar baz bar Foo');
10-
})
11-
});
10+
});
11+
});

packages/amplify-appsync-simulator/src/__tests__/velocity/value-mapper/to-json.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Velocity - ValueMapper toJSON', () => {
1313
it('should not call toJSON if the object is null', () => {
1414
expect(toJSON(null)).toEqual(null);
1515
});
16-
16+
1717
it('should return the source object if it doesnot implement toJSON', () => {
1818
const testObj = {
1919
foo: 'Foo',

packages/amplify-appsync-simulator/src/data-loader/dynamo-db/index.ts

+8-36
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,7 @@ export class DynamoDBDataLoader implements AmplifyAppSyncSimulatorDataLoader {
102102

103103
return this.getItem({ key, consistentRead: true });
104104
}
105-
private async query({
106-
query: keyCondition,
107-
filter,
108-
index,
109-
nextToken,
110-
limit,
111-
scanIndexForward = true,
112-
consistentRead = false,
113-
select,
114-
}) {
105+
private async query({ query: keyCondition, filter, index, nextToken, limit, scanIndexForward = true, consistentRead = false, select }) {
115106
keyCondition = keyCondition || { expression: null };
116107
filter = filter || { expression: null };
117108
const params = {
@@ -133,18 +124,14 @@ export class DynamoDBDataLoader implements AmplifyAppSyncSimulatorDataLoader {
133124
ScanIndexForward: scanIndexForward,
134125
Select: select || 'ALL_ATTRIBUTES',
135126
};
136-
const {
137-
Items: items,
138-
ScannedCount: scannedCount,
139-
LastEvaluatedKey: resultNextToken = null,
140-
} = await this.client.query(params as any).promise();
127+
const { Items: items, ScannedCount: scannedCount, LastEvaluatedKey: resultNextToken = null } = await this.client
128+
.query(params as any)
129+
.promise();
141130

142131
return {
143132
items: items.map(item => unmarshall(item)),
144133
scannedCount,
145-
nextToken: resultNextToken
146-
? Buffer.from(JSON.stringify(resultNextToken)).toString('base64')
147-
: null,
134+
nextToken: resultNextToken ? Buffer.from(JSON.stringify(resultNextToken)).toString('base64') : null,
148135
};
149136
}
150137

@@ -194,16 +181,7 @@ export class DynamoDBDataLoader implements AmplifyAppSyncSimulatorDataLoader {
194181
return unmarshall(deleted);
195182
}
196183
private async scan(payload) {
197-
const {
198-
filter,
199-
index,
200-
limit,
201-
consistentRead = false,
202-
nextToken,
203-
select,
204-
totalSegments,
205-
segment,
206-
} = payload;
184+
const { filter, index, limit, consistentRead = false, nextToken, select, totalSegments, segment } = payload;
207185

208186
const params = {
209187
TableName: this.tableName,
@@ -226,18 +204,12 @@ export class DynamoDBDataLoader implements AmplifyAppSyncSimulatorDataLoader {
226204
},
227205
});
228206
}
229-
const {
230-
Items: items,
231-
ScannedCount: scannedCount,
232-
LastEvaluatedKey: resultNextToken = null,
233-
} = await this.client.scan(params).promise();
207+
const { Items: items, ScannedCount: scannedCount, LastEvaluatedKey: resultNextToken = null } = await this.client.scan(params).promise();
234208

235209
return {
236210
items: items.map(item => unmarshall(item)),
237211
scannedCount,
238-
nextToken: resultNextToken
239-
? Buffer.from(JSON.stringify(resultNextToken)).toString('base64')
240-
: null,
212+
nextToken: resultNextToken ? Buffer.from(JSON.stringify(resultNextToken)).toString('base64') : null,
241213
};
242214
}
243215
}

packages/amplify-appsync-simulator/src/data-loader/dynamo-db/utils/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function unmarshall(raw, isRaw: boolean = true) {
2626
...sum,
2727
[key]: unmarshall(value, false),
2828
}),
29-
{},
29+
{}
3030
);
3131
}
3232

packages/amplify-appsync-simulator/src/index.ts

+5-13
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class AmplifyAppSyncSimulator {
4141
serverConfig: AppSyncSimulatorServerConfig = {
4242
port: 0,
4343
wsPort: 0,
44-
},
44+
}
4545
) {
4646
this._serverConfig = serverConfig;
4747
this._pubsub = new PubSub();
@@ -77,11 +77,7 @@ export class AmplifyAppSyncSimulator {
7777
}, new Map());
7878

7979
this.functions = (config.functions || []).reduce((map, fn) => {
80-
const {
81-
dataSourceName,
82-
requestMappingTemplateLocation,
83-
responseMappingTemplateLocation,
84-
} = fn;
80+
const { dataSourceName, requestMappingTemplateLocation, responseMappingTemplateLocation } = fn;
8581
map.set(
8682
fn.name,
8783
new AmplifySimulatorFunction(
@@ -90,8 +86,8 @@ export class AmplifyAppSyncSimulator {
9086
requestMappingTemplateLocation: requestMappingTemplateLocation,
9187
responseMappingTemplateLocation: responseMappingTemplateLocation,
9288
},
93-
this,
94-
),
89+
this
90+
)
9591
);
9692
return map;
9793
}, new Map());
@@ -109,11 +105,7 @@ export class AmplifyAppSyncSimulator {
109105
return map;
110106
}, new Map());
111107

112-
this._schema = generateResolvers(
113-
new Source(config.schema.content, config.schema.path),
114-
config.resolvers,
115-
this,
116-
);
108+
this._schema = generateResolvers(new Source(config.schema.content, config.schema.path), config.resolvers, this);
117109
this._config = config;
118110
} catch (e) {
119111
this._schema = lastSchema;

packages/amplify-appsync-simulator/src/mqtt-server/client.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,7 @@ export class Client {
175175
}
176176

177177
// skip delivery of messages in $SYS for wildcards
178-
forward =
179-
forward &&
180-
!(
181-
topic.indexOf('$SYS') >= 0 &&
182-
((indexWildcard >= 0 && indexWildcard < 2) || (indexPlus >= 0 && indexPlus < 2))
183-
);
178+
forward = forward && !(topic.indexOf('$SYS') >= 0 && ((indexWildcard >= 0 && indexWildcard < 2) || (indexPlus >= 0 && indexPlus < 2)));
184179

185180
if (forward) {
186181
if (options._dedupId === undefined) {
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
export function defer (done) {
2-
if (typeof done === "function") {
1+
export function defer(done) {
2+
if (typeof done === 'function') {
33
setImmediate(done);
44
}
55
}
6-

0 commit comments

Comments
 (0)