Skip to content

Commit 166f620

Browse files
chore: break long lines in snippets into multiline
1 parent 1a412ec commit 166f620

10 files changed

Lines changed: 153 additions & 27 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ const client = new Finch({
5353
accessToken: 'My Access Token',
5454
});
5555

56-
const [individualInDirectory]: [Finch.HRIS.IndividualInDirectory] = await client.hris.directory.list();
56+
const [individualInDirectory]: [Finch.HRIS.IndividualInDirectory] =
57+
await client.hris.directory.list();
5758
```
5859

5960
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -176,7 +177,9 @@ import Finch from '@tryfinch/finch-api';
176177

177178
const client = new Finch();
178179

179-
const page = await client.hris.directory.list({ headers: { 'Finch-API-Version': 'My-Custom-Value' } });
180+
const page = await client.hris.directory.list({
181+
headers: { 'Finch-API-Version': 'My-Custom-Value' },
182+
});
180183
const individualInDirectory = page.individuals[0];
181184
```
182185

tests/api-resources/hris/benefits/individuals.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ describe('resource individuals', () => {
3232
annual_contribution_limit: 'individual',
3333
annual_maximum: null,
3434
catch_up: true,
35-
company_contribution: { amount: 0, tiers: [{ match: 0, threshold: 0 }], type: 'fixed' },
35+
company_contribution: {
36+
amount: 0,
37+
tiers: [{ match: 0, threshold: 0 }],
38+
type: 'fixed',
39+
},
3640
effective_date: '2019-12-27',
3741
employee_deduction: { amount: 10000, type: 'fixed' },
3842
},

tests/api-resources/hris/company/pay-statement-item/rules.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ describe('resource rules', () => {
2626
{
2727
entity_ids: ['550e8400-e29b-41d4-a716-446655440000'],
2828
attributes: { metadata: { foo: 'bar' } },
29-
conditions: [{ field: 'field', operator: 'equals', value: 'value' }],
29+
conditions: [
30+
{
31+
field: 'field',
32+
operator: 'equals',
33+
value: 'value',
34+
},
35+
],
3036
effective_end_date: 'effective_end_date',
3137
effective_start_date: 'effective_start_date',
3238
entity_type: 'pay_statement_item',
@@ -52,7 +58,10 @@ describe('resource rules', () => {
5258
await expect(
5359
client.hris.company.payStatementItem.rules.update(
5460
'rule_id',
55-
{ entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], optionalProperty: {} },
61+
{
62+
entity_ids: ['550e8400-e29b-41d4-a716-446655440000'],
63+
optionalProperty: {},
64+
},
5665
{ path: '/_stainless_unknown_path' },
5766
),
5867
).rejects.toThrow(Finch.NotFoundError);

tests/api-resources/hris/directory.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ describe('resource directory', () => {
2323
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
2424
await expect(
2525
client.hris.directory.list(
26-
{ entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], limit: 0, offset: 0 },
26+
{
27+
entity_ids: ['550e8400-e29b-41d4-a716-446655440000'],
28+
limit: 0,
29+
offset: 0,
30+
},
2731
{ path: '/_stainless_unknown_path' },
2832
),
2933
).rejects.toThrow(Finch.NotFoundError);
@@ -44,7 +48,11 @@ describe('resource directory', () => {
4448
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
4549
await expect(
4650
client.hris.directory.listIndividuals(
47-
{ entity_ids: ['550e8400-e29b-41d4-a716-446655440000'], limit: 0, offset: 0 },
51+
{
52+
entity_ids: ['550e8400-e29b-41d4-a716-446655440000'],
53+
limit: 0,
54+
offset: 0,
55+
},
4856
{ path: '/_stainless_unknown_path' },
4957
),
5058
).rejects.toThrow(Finch.NotFoundError);

tests/api-resources/hris/pay-statements.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ describe('resource payStatements', () => {
2323

2424
test('retrieveMany: required and optional params', async () => {
2525
const response = await client.hris.payStatements.retrieveMany({
26-
requests: [{ payment_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', limit: 50, offset: 0 }],
26+
requests: [
27+
{
28+
payment_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
29+
limit: 50,
30+
offset: 0,
31+
},
32+
],
2733
entity_ids: ['550e8400-e29b-41d4-a716-446655440000'],
2834
});
2935
});

tests/api-resources/sandbox/company.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ describe('resource company', () => {
4848
routing_number: 'routing_number',
4949
},
5050
],
51-
departments: [{ name: 'name', parent: { name: 'name' } }],
51+
departments: [
52+
{
53+
name: 'name',
54+
parent: { name: 'name' },
55+
},
56+
],
5257
ein: 'ein',
5358
entity: { subtype: 's_corporation', type: 'llc' },
5459
legal_name: 'legal_name',

tests/api-resources/sandbox/directory.test.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ describe('resource directory', () => {
2727
body: [
2828
{
2929
class_code: 'class_code',
30-
custom_fields: [{ name: 'name', value: {} }],
30+
custom_fields: [
31+
{
32+
name: 'name',
33+
value: {},
34+
},
35+
],
3136
department: { name: 'name' },
3237
dob: 'dob',
3338
emails: [{ data: 'data', type: 'work' }],
@@ -38,9 +43,19 @@ describe('resource directory', () => {
3843
ethnicity: 'asian',
3944
first_name: 'first_name',
4045
gender: 'female',
41-
income: { amount: 0, currency: 'currency', effective_date: '2019-12-27', unit: 'yearly' },
46+
income: {
47+
amount: 0,
48+
currency: 'currency',
49+
effective_date: '2019-12-27',
50+
unit: 'yearly',
51+
},
4252
income_history: [
43-
{ amount: 0, currency: 'currency', effective_date: '2019-12-27', unit: 'yearly' },
53+
{
54+
amount: 0,
55+
currency: 'currency',
56+
effective_date: '2019-12-27',
57+
unit: 'yearly',
58+
},
4459
],
4560
is_active: true,
4661
last_name: 'last_name',

tests/api-resources/sandbox/employment.test.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,31 @@ describe('resource employment', () => {
2626
'individual_id',
2727
{
2828
class_code: 'class_code',
29-
custom_fields: [{ name: 'name', value: {} }],
29+
custom_fields: [
30+
{
31+
name: 'name',
32+
value: {},
33+
},
34+
],
3035
department: { name: 'name' },
3136
employment: { subtype: 'full_time', type: 'employee' },
3237
employment_status: 'active',
3338
end_date: 'end_date',
3439
first_name: 'first_name',
35-
income: { amount: 0, currency: 'currency', effective_date: '2019-12-27', unit: 'yearly' },
36-
income_history: [{ amount: 0, currency: 'currency', effective_date: '2019-12-27', unit: 'yearly' }],
40+
income: {
41+
amount: 0,
42+
currency: 'currency',
43+
effective_date: '2019-12-27',
44+
unit: 'yearly',
45+
},
46+
income_history: [
47+
{
48+
amount: 0,
49+
currency: 'currency',
50+
effective_date: '2019-12-27',
51+
unit: 'yearly',
52+
},
53+
],
3754
is_active: true,
3855
last_name: 'last_name',
3956
latest_rehire_date: 'latest_rehire_date',

tests/api-resources/sandbox/payment.test.ts

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,40 @@ describe('resource payment', () => {
2828
pay_statements: [
2929
{
3030
individual_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
31-
earnings: [{ amount: 0, hours: 0, name: 'x', type: 'bonus' }],
32-
employee_deductions: [{ amount: 0, name: 'x', pre_tax: true, type: '457' }],
33-
employer_contributions: [{ amount: 0, name: 'x', type: '457' }],
31+
earnings: [
32+
{
33+
amount: 0,
34+
hours: 0,
35+
name: 'x',
36+
type: 'bonus',
37+
},
38+
],
39+
employee_deductions: [
40+
{
41+
amount: 0,
42+
name: 'x',
43+
pre_tax: true,
44+
type: '457',
45+
},
46+
],
47+
employer_contributions: [
48+
{
49+
amount: 0,
50+
name: 'x',
51+
type: '457',
52+
},
53+
],
3454
gross_pay: 1,
3555
net_pay: 9007199254740991,
3656
payment_method: 'check',
37-
taxes: [{ amount: 0, employer: true, name: 'x', type: 'federal' }],
57+
taxes: [
58+
{
59+
amount: 0,
60+
employer: true,
61+
name: 'x',
62+
type: 'federal',
63+
},
64+
],
3865
total_hours: 1,
3966
type: 'off_cycle_payroll',
4067
},

tests/index.test.ts

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ describe('instantiate client', () => {
8787
error: jest.fn(),
8888
};
8989

90-
const client = new Finch({ logger: logger, logLevel: 'debug', accessToken: 'My Access Token' });
90+
const client = new Finch({
91+
logger: logger,
92+
logLevel: 'debug',
93+
accessToken: 'My Access Token',
94+
});
9195

9296
await forceAPIResponseForClient(client);
9397
expect(debugMock).toHaveBeenCalled();
@@ -107,7 +111,11 @@ describe('instantiate client', () => {
107111
error: jest.fn(),
108112
};
109113

110-
const client = new Finch({ logger: logger, logLevel: 'info', accessToken: 'My Access Token' });
114+
const client = new Finch({
115+
logger: logger,
116+
logLevel: 'info',
117+
accessToken: 'My Access Token',
118+
});
111119

112120
await forceAPIResponseForClient(client);
113121
expect(debugMock).not.toHaveBeenCalled();
@@ -157,7 +165,11 @@ describe('instantiate client', () => {
157165
};
158166

159167
process.env['FINCH_LOG'] = 'debug';
160-
const client = new Finch({ logger: logger, logLevel: 'off', accessToken: 'My Access Token' });
168+
const client = new Finch({
169+
logger: logger,
170+
logLevel: 'off',
171+
accessToken: 'My Access Token',
172+
});
161173

162174
await forceAPIResponseForClient(client);
163175
expect(debugMock).not.toHaveBeenCalled();
@@ -173,7 +185,11 @@ describe('instantiate client', () => {
173185
};
174186

175187
process.env['FINCH_LOG'] = 'not a log level';
176-
const client = new Finch({ logger: logger, logLevel: 'debug', accessToken: 'My Access Token' });
188+
const client = new Finch({
189+
logger: logger,
190+
logLevel: 'debug',
191+
accessToken: 'My Access Token',
192+
});
177193
expect(client.logLevel).toBe('debug');
178194
expect(warnMock).not.toHaveBeenCalled();
179195
});
@@ -535,7 +551,11 @@ describe('retries', () => {
535551
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
536552
};
537553

538-
const client = new Finch({ accessToken: 'My Access Token', timeout: 10, fetch: testFetch });
554+
const client = new Finch({
555+
accessToken: 'My Access Token',
556+
timeout: 10,
557+
fetch: testFetch,
558+
});
539559

540560
expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
541561
expect(count).toEqual(2);
@@ -565,7 +585,11 @@ describe('retries', () => {
565585
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
566586
};
567587

568-
const client = new Finch({ accessToken: 'My Access Token', fetch: testFetch, maxRetries: 4 });
588+
const client = new Finch({
589+
accessToken: 'My Access Token',
590+
fetch: testFetch,
591+
maxRetries: 4,
592+
});
569593

570594
expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
571595

@@ -589,7 +613,11 @@ describe('retries', () => {
589613
capturedRequest = init;
590614
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
591615
};
592-
const client = new Finch({ accessToken: 'My Access Token', fetch: testFetch, maxRetries: 4 });
616+
const client = new Finch({
617+
accessToken: 'My Access Token',
618+
fetch: testFetch,
619+
maxRetries: 4,
620+
});
593621

594622
expect(
595623
await client.request({
@@ -651,7 +679,11 @@ describe('retries', () => {
651679
capturedRequest = init;
652680
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
653681
};
654-
const client = new Finch({ accessToken: 'My Access Token', fetch: testFetch, maxRetries: 4 });
682+
const client = new Finch({
683+
accessToken: 'My Access Token',
684+
fetch: testFetch,
685+
maxRetries: 4,
686+
});
655687

656688
expect(
657689
await client.request({

0 commit comments

Comments
 (0)