Skip to content

Commit 8d9ad04

Browse files
chore: update mock server docs
1 parent f1deef8 commit 8d9ad04

15 files changed

Lines changed: 76 additions & 82 deletions

CONTRIBUTING.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ $ pnpm link -—global @imagekit/nodejs
6565

6666
## Running tests
6767

68-
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
69-
70-
```sh
71-
$ npx prism mock path/to/your/openapi.yml
72-
```
73-
7468
```sh
7569
$ yarn run test
7670
```

tests/api-resources/accounts/origins.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const client = new ImageKit({
99
});
1010

1111
describe('resource origins', () => {
12-
// Prism tests are disabled
12+
// Mock server tests are disabled
1313
test.skip('create: only required params', async () => {
1414
const responsePromise = client.accounts.origins.create({
1515
accessKey: 'AKIAIOSFODNN7EXAMPLE',
@@ -27,7 +27,7 @@ describe('resource origins', () => {
2727
expect(dataAndResponse.response).toBe(rawResponse);
2828
});
2929

30-
// Prism tests are disabled
30+
// Mock server tests are disabled
3131
test.skip('create: required and optional params', async () => {
3232
const response = await client.accounts.origins.create({
3333
accessKey: 'AKIAIOSFODNN7EXAMPLE',
@@ -41,7 +41,7 @@ describe('resource origins', () => {
4141
});
4242
});
4343

44-
// Prism tests are disabled
44+
// Mock server tests are disabled
4545
test.skip('update: only required params', async () => {
4646
const responsePromise = client.accounts.origins.update('id', {
4747
accessKey: 'AKIAIOSFODNN7EXAMPLE',
@@ -59,7 +59,7 @@ describe('resource origins', () => {
5959
expect(dataAndResponse.response).toBe(rawResponse);
6060
});
6161

62-
// Prism tests are disabled
62+
// Mock server tests are disabled
6363
test.skip('update: required and optional params', async () => {
6464
const response = await client.accounts.origins.update('id', {
6565
accessKey: 'AKIAIOSFODNN7EXAMPLE',
@@ -73,7 +73,7 @@ describe('resource origins', () => {
7373
});
7474
});
7575

76-
// Prism tests are disabled
76+
// Mock server tests are disabled
7777
test.skip('list', async () => {
7878
const responsePromise = client.accounts.origins.list();
7979
const rawResponse = await responsePromise.asResponse();
@@ -85,7 +85,7 @@ describe('resource origins', () => {
8585
expect(dataAndResponse.response).toBe(rawResponse);
8686
});
8787

88-
// Prism tests are disabled
88+
// Mock server tests are disabled
8989
test.skip('delete', async () => {
9090
const responsePromise = client.accounts.origins.delete('id');
9191
const rawResponse = await responsePromise.asResponse();
@@ -97,7 +97,7 @@ describe('resource origins', () => {
9797
expect(dataAndResponse.response).toBe(rawResponse);
9898
});
9999

100-
// Prism tests are disabled
100+
// Mock server tests are disabled
101101
test.skip('get', async () => {
102102
const responsePromise = client.accounts.origins.get('id');
103103
const rawResponse = await responsePromise.asResponse();

tests/api-resources/accounts/url-endpoints.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const client = new ImageKit({
99
});
1010

1111
describe('resource urlEndpoints', () => {
12-
// Prism tests are disabled
12+
// Mock server tests are disabled
1313
test.skip('create: only required params', async () => {
1414
const responsePromise = client.accounts.urlEndpoints.create({ description: 'My custom URL endpoint' });
1515
const rawResponse = await responsePromise.asResponse();
@@ -21,7 +21,7 @@ describe('resource urlEndpoints', () => {
2121
expect(dataAndResponse.response).toBe(rawResponse);
2222
});
2323

24-
// Prism tests are disabled
24+
// Mock server tests are disabled
2525
test.skip('create: required and optional params', async () => {
2626
const response = await client.accounts.urlEndpoints.create({
2727
description: 'My custom URL endpoint',
@@ -31,7 +31,7 @@ describe('resource urlEndpoints', () => {
3131
});
3232
});
3333

34-
// Prism tests are disabled
34+
// Mock server tests are disabled
3535
test.skip('update: only required params', async () => {
3636
const responsePromise = client.accounts.urlEndpoints.update('id', {
3737
description: 'My custom URL endpoint',
@@ -45,7 +45,7 @@ describe('resource urlEndpoints', () => {
4545
expect(dataAndResponse.response).toBe(rawResponse);
4646
});
4747

48-
// Prism tests are disabled
48+
// Mock server tests are disabled
4949
test.skip('update: required and optional params', async () => {
5050
const response = await client.accounts.urlEndpoints.update('id', {
5151
description: 'My custom URL endpoint',
@@ -55,7 +55,7 @@ describe('resource urlEndpoints', () => {
5555
});
5656
});
5757

58-
// Prism tests are disabled
58+
// Mock server tests are disabled
5959
test.skip('list', async () => {
6060
const responsePromise = client.accounts.urlEndpoints.list();
6161
const rawResponse = await responsePromise.asResponse();
@@ -67,7 +67,7 @@ describe('resource urlEndpoints', () => {
6767
expect(dataAndResponse.response).toBe(rawResponse);
6868
});
6969

70-
// Prism tests are disabled
70+
// Mock server tests are disabled
7171
test.skip('delete', async () => {
7272
const responsePromise = client.accounts.urlEndpoints.delete('id');
7373
const rawResponse = await responsePromise.asResponse();
@@ -79,7 +79,7 @@ describe('resource urlEndpoints', () => {
7979
expect(dataAndResponse.response).toBe(rawResponse);
8080
});
8181

82-
// Prism tests are disabled
82+
// Mock server tests are disabled
8383
test.skip('get', async () => {
8484
const responsePromise = client.accounts.urlEndpoints.get('id');
8585
const rawResponse = await responsePromise.asResponse();

tests/api-resources/accounts/usage.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const client = new ImageKit({
99
});
1010

1111
describe('resource usage', () => {
12-
// Prism tests are disabled
12+
// Mock server tests are disabled
1313
test.skip('get: only required params', async () => {
1414
const responsePromise = client.accounts.usage.get({ endDate: '2019-12-27', startDate: '2019-12-27' });
1515
const rawResponse = await responsePromise.asResponse();
@@ -21,7 +21,7 @@ describe('resource usage', () => {
2121
expect(dataAndResponse.response).toBe(rawResponse);
2222
});
2323

24-
// Prism tests are disabled
24+
// Mock server tests are disabled
2525
test.skip('get: required and optional params', async () => {
2626
const response = await client.accounts.usage.get({ endDate: '2019-12-27', startDate: '2019-12-27' });
2727
});

tests/api-resources/assets.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const client = new ImageKit({
99
});
1010

1111
describe('resource assets', () => {
12-
// Prism tests are disabled
12+
// Mock server tests are disabled
1313
test.skip('list', async () => {
1414
const responsePromise = client.assets.list();
1515
const rawResponse = await responsePromise.asResponse();
@@ -21,7 +21,7 @@ describe('resource assets', () => {
2121
expect(dataAndResponse.response).toBe(rawResponse);
2222
});
2323

24-
// Prism tests are disabled
24+
// Mock server tests are disabled
2525
test.skip('list: request options and params are passed correctly', async () => {
2626
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
2727
await expect(

tests/api-resources/beta/v2/files.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const client = new ImageKit({
99
});
1010

1111
describe('resource files', () => {
12-
// Prism tests are disabled
12+
// Mock server tests are disabled
1313
test.skip('upload: only required params', async () => {
1414
const responsePromise = client.beta.v2.files.upload({
1515
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
@@ -24,7 +24,7 @@ describe('resource files', () => {
2424
expect(dataAndResponse.response).toBe(rawResponse);
2525
});
2626

27-
// Prism tests are disabled
27+
// Mock server tests are disabled
2828
test.skip('upload: required and optional params', async () => {
2929
const response = await client.beta.v2.files.upload({
3030
file: await toFile(Buffer.from('# my file contents'), 'README.md'),

tests/api-resources/cache/invalidation.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const client = new ImageKit({
99
});
1010

1111
describe('resource invalidation', () => {
12-
// Prism tests are disabled
12+
// Mock server tests are disabled
1313
test.skip('create: only required params', async () => {
1414
const responsePromise = client.cache.invalidation.create({
1515
url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg',
@@ -23,14 +23,14 @@ describe('resource invalidation', () => {
2323
expect(dataAndResponse.response).toBe(rawResponse);
2424
});
2525

26-
// Prism tests are disabled
26+
// Mock server tests are disabled
2727
test.skip('create: required and optional params', async () => {
2828
const response = await client.cache.invalidation.create({
2929
url: 'https://ik.imagekit.io/your_imagekit_id/default-image.jpg',
3030
});
3131
});
3232

33-
// Prism tests are disabled
33+
// Mock server tests are disabled
3434
test.skip('get', async () => {
3535
const responsePromise = client.cache.invalidation.get('requestId');
3636
const rawResponse = await responsePromise.asResponse();

tests/api-resources/custom-metadata-fields.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const client = new ImageKit({
99
});
1010

1111
describe('resource customMetadataFields', () => {
12-
// Prism tests are disabled
12+
// Mock server tests are disabled
1313
test.skip('create: only required params', async () => {
1414
const responsePromise = client.customMetadataFields.create({
1515
label: 'price',
@@ -25,7 +25,7 @@ describe('resource customMetadataFields', () => {
2525
expect(dataAndResponse.response).toBe(rawResponse);
2626
});
2727

28-
// Prism tests are disabled
28+
// Mock server tests are disabled
2929
test.skip('create: required and optional params', async () => {
3030
const response = await client.customMetadataFields.create({
3131
label: 'price',
@@ -43,7 +43,7 @@ describe('resource customMetadataFields', () => {
4343
});
4444
});
4545

46-
// Prism tests are disabled
46+
// Mock server tests are disabled
4747
test.skip('update', async () => {
4848
const responsePromise = client.customMetadataFields.update('id');
4949
const rawResponse = await responsePromise.asResponse();
@@ -55,7 +55,7 @@ describe('resource customMetadataFields', () => {
5555
expect(dataAndResponse.response).toBe(rawResponse);
5656
});
5757

58-
// Prism tests are disabled
58+
// Mock server tests are disabled
5959
test.skip('update: request options and params are passed correctly', async () => {
6060
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
6161
await expect(
@@ -78,7 +78,7 @@ describe('resource customMetadataFields', () => {
7878
).rejects.toThrow(ImageKit.NotFoundError);
7979
});
8080

81-
// Prism tests are disabled
81+
// Mock server tests are disabled
8282
test.skip('list', async () => {
8383
const responsePromise = client.customMetadataFields.list();
8484
const rawResponse = await responsePromise.asResponse();
@@ -90,7 +90,7 @@ describe('resource customMetadataFields', () => {
9090
expect(dataAndResponse.response).toBe(rawResponse);
9191
});
9292

93-
// Prism tests are disabled
93+
// Mock server tests are disabled
9494
test.skip('list: request options and params are passed correctly', async () => {
9595
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
9696
await expect(
@@ -101,7 +101,7 @@ describe('resource customMetadataFields', () => {
101101
).rejects.toThrow(ImageKit.NotFoundError);
102102
});
103103

104-
// Prism tests are disabled
104+
// Mock server tests are disabled
105105
test.skip('delete', async () => {
106106
const responsePromise = client.customMetadataFields.delete('id');
107107
const rawResponse = await responsePromise.asResponse();

tests/api-resources/files/bulk.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const client = new ImageKit({
99
});
1010

1111
describe('resource bulk', () => {
12-
// Prism tests are disabled
12+
// Mock server tests are disabled
1313
test.skip('delete: only required params', async () => {
1414
const responsePromise = client.files.bulk.delete({
1515
fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],
@@ -23,14 +23,14 @@ describe('resource bulk', () => {
2323
expect(dataAndResponse.response).toBe(rawResponse);
2424
});
2525

26-
// Prism tests are disabled
26+
// Mock server tests are disabled
2727
test.skip('delete: required and optional params', async () => {
2828
const response = await client.files.bulk.delete({
2929
fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],
3030
});
3131
});
3232

33-
// Prism tests are disabled
33+
// Mock server tests are disabled
3434
test.skip('addTags: only required params', async () => {
3535
const responsePromise = client.files.bulk.addTags({
3636
fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],
@@ -45,15 +45,15 @@ describe('resource bulk', () => {
4545
expect(dataAndResponse.response).toBe(rawResponse);
4646
});
4747

48-
// Prism tests are disabled
48+
// Mock server tests are disabled
4949
test.skip('addTags: required and optional params', async () => {
5050
const response = await client.files.bulk.addTags({
5151
fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],
5252
tags: ['t-shirt', 'round-neck', 'sale2019'],
5353
});
5454
});
5555

56-
// Prism tests are disabled
56+
// Mock server tests are disabled
5757
test.skip('removeAITags: only required params', async () => {
5858
const responsePromise = client.files.bulk.removeAITags({
5959
AITags: ['t-shirt', 'round-neck', 'sale2019'],
@@ -68,15 +68,15 @@ describe('resource bulk', () => {
6868
expect(dataAndResponse.response).toBe(rawResponse);
6969
});
7070

71-
// Prism tests are disabled
71+
// Mock server tests are disabled
7272
test.skip('removeAITags: required and optional params', async () => {
7373
const response = await client.files.bulk.removeAITags({
7474
AITags: ['t-shirt', 'round-neck', 'sale2019'],
7575
fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],
7676
});
7777
});
7878

79-
// Prism tests are disabled
79+
// Mock server tests are disabled
8080
test.skip('removeTags: only required params', async () => {
8181
const responsePromise = client.files.bulk.removeTags({
8282
fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],
@@ -91,7 +91,7 @@ describe('resource bulk', () => {
9191
expect(dataAndResponse.response).toBe(rawResponse);
9292
});
9393

94-
// Prism tests are disabled
94+
// Mock server tests are disabled
9595
test.skip('removeTags: required and optional params', async () => {
9696
const response = await client.files.bulk.removeTags({
9797
fileIds: ['598821f949c0a938d57563bd', '598821f949c0a938d57563be'],

0 commit comments

Comments
 (0)