Skip to content

Commit

Permalink
update tests, fixtures & snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriiAndreiev committed Oct 10, 2024
1 parent 7679e01 commit fd5a7f5
Show file tree
Hide file tree
Showing 29 changed files with 397 additions and 150 deletions.
170 changes: 85 additions & 85 deletions packages/sdk-snippets/src/targets/__snapshots__/targets.test.ts.snap

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const dotnet6: Client = {
}
} else {
pushVariable(
`${escapeForObjectKey(data.name)} = "${escapeForDoubleQuotes(
`${escapeForObjectKey(data.name, true)} = "${escapeForDoubleQuotes(
data.default || data.default === '' ? data.default : data.name,
)}",`,
variableOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ await context.Response.WriteAsJsonAsync(new
name = "",
// OAS Security variables
petstore_auth = "",
keys = new[]
{
new
{
petstore_auth = "",
},
}
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,25 @@ await context.Response.WriteAsJsonAsync(new
normal_server_var = "",

// OAS Security variables
"\"petstore\" auth" = "default \"key\"\\",
"basic-auth" = new { user = "user", pass = "pass" },
normal_security_var = new { user = "user", pass = "pass" },
keys = new[]
{
new
{
"\"petstore\" auth" = "default \"key\"\\",
},
new
{
name = "basic-auth",
user = "user",
pass = "pass",
},
new
{
name = "normal_security_var",
user = "user",
pass = "pass",
},
}
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,19 @@ await context.Response.WriteAsJsonAsync(new
port = "",
// OAS Security variables
petstore_auth = "default-key",
basic_auth = new { user = "user", pass = "pass" },
keys = new[]
{
new
{
petstore_auth = "default-key",
},
new
{
name = "basic_auth",
user = "user",
pass = "pass",
},
}
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,29 @@ await context.Response.WriteAsJsonAsync(new
await context.Response.WriteAsJsonAsync(new
{
// OAS Security variables
api_key = "default-api_key-key",
http_basic = new { user = "user", pass = "pass" },
http_bearer = "default-http_bearer-key",
oauth2 = "default-oauth2-key",
keys = new[]
{
new
{
name = "api_key",
apiKey = "default-api_key-key",
},
new
{
name = "http_basic",
user = "user",
pass = "pass",
},
new
{
name = "http_bearer",
bearer = "default-http_bearer-key",
},
new
{
oauth2 = "default-oauth2-key",
},
}
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,19 @@ await context.Response.WriteAsJsonAsync(new
await context.Response.WriteAsJsonAsync(new
{
// OAS Security variables
petstore_auth = "default-key",
basic_auth = new { user = "user", pass = "pass" },
keys = new[]
{
new
{
petstore_auth = "default-key",
},
new
{
name = "basic_auth",
user = "user",
pass = "pass",
},
}
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ app.post('/webhook', express.json({ type: 'application/json' }), async (req, res
name: '',

// OAS Security variables
petstore_auth: '',
keys: [
{
petstore_auth: '',
},
]
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@ app.post('/webhook', express.json({ type: 'application/json' }), async (req, res
normal_server_var: '',

// OAS Security variables
'"petstore" auth': 'default "key"\\',
'basic-auth': { user: 'user', pass: 'pass' },
normal_security_var: { user: 'user', pass: 'pass' },
keys: [
{
'"petstore" auth': 'default "key"\\',
},
{
name: 'basic-auth',
user: 'user',
pass: 'pass',
},
{
name: 'normal_security_var',
user: 'user',
pass: 'pass',
},
]
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@ app.post('/webhook', express.json({ type: 'application/json' }), async (req, res
port: '',

// OAS Security variables
petstore_auth: 'default-key',
basic_auth: { user: 'user', pass: 'pass' },
keys: [
{
petstore_auth: 'default-key',
},
{
name: 'basic_auth',
user: 'user',
pass: 'pass',
},
]
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,24 @@ app.post('/webhook', express.json({ type: 'application/json' }), async (req, res
// const user = await db.find({ email: req.body.email })
return res.json({
// OAS Security variables
api_key: 'default-api_key-key',
http_basic: { user: 'user', pass: 'pass' },
http_bearer: 'default-http_bearer-key',
oauth2: 'default-oauth2-key',
keys: [
{
name: 'api_key',
apiKey: 'default-api_key-key',
},
{
name: 'http_basic',
user: 'user',
pass: 'pass',
},
{
name: 'http_bearer',
bearer: 'default-http_bearer-key',
},
{
oauth2: 'default-oauth2-key',
},
]
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ app.post('/webhook', express.json({ type: 'application/json' }), async (req, res
// const user = await db.find({ email: req.body.email })
return res.json({
// OAS Security variables
petstore_auth: 'default-key',
basic_auth: { user: 'user', pass: 'pass' },
keys: [
{
petstore_auth: 'default-key',
},
{
name: 'basic_auth',
user: 'user',
pass: 'pass',
},
]
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { VariableOptions } from '../../../../helpers/code-builder';
import type { Client } from '../../../targets';

import { CodeBuilder } from '../../../../helpers/code-builder';
import { escapeForObjectKey, escapeForSingleQuotes } from '../../../../helpers/escape';
import { escapeForSingleQuotes } from '../../../../helpers/escape';

export const laravel: Client = {
info: {
Expand Down Expand Up @@ -109,7 +109,7 @@ export const laravel: Client = {
}
} else {
pushVariable(
`'${escapeForObjectKey(data.name)}': '${escapeForSingleQuotes(
`'${escapeForSingleQuotes(data.name)}' => '${escapeForSingleQuotes(
data.default || data.default === '' ? data.default : data.name,
)}',`,
variableOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
'name' => '',

// OAS Security variables
'petstore_auth' => '',
'keys' => [
[
'petstore_auth' => '',
],
]
]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,20 @@
'normal_server_var' => '',

// OAS Security variables
'"petstore" auth' => 'default "key"\\',
'basic-auth' => ['user' => 'user', 'pass' => 'pass'],
'normal_security_var' => ['user' => 'user', 'pass' => 'pass'],
'keys' => [
[
'"petstore" auth' => 'default "key"\\',
],
[
'name' => 'basic-auth',
'user' => 'user',
'pass' => 'pass',
],
[
'name' => 'normal_security_var',
'user' => 'user',
'pass' => 'pass',
],
]
]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@
'port' => '',

// OAS Security variables
'petstore_auth' => 'default-key',
'basic_auth' => ['user' => 'user', 'pass' => 'pass'],
'keys' => [
[
'petstore_auth' => 'default-key',
],
[
'name' => 'basic_auth',
'user' => 'user',
'pass' => 'pass',
],
]
]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,23 @@
// $user = DB::table('users')->where('email', $request->input('email'))->limit(1)->get();
return response()->json([
// OAS Security variables
'api_key' => 'default-api_key-key',
'http_basic' => ['user' => 'user', 'pass' => 'pass'],
'http_bearer' => 'default-http_bearer-key',
'oauth2' => 'default-oauth2-key',
'keys' => [
[
'name' => 'api_key',
'apiKey' => 'default-api_key-key',
],
[
'name' => 'http_basic',
'user' => 'user',
'pass' => 'pass',
],
[
'name' => 'http_bearer',
'bearer' => 'default-http_bearer-key',
],
[
'oauth2' => 'default-oauth2-key',
],
]
]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@
// $user = DB::table('users')->where('email', $request->input('email'))->limit(1)->get();
return response()->json([
// OAS Security variables
'petstore_auth' => 'default-key',
'basic_auth' => ['user' => 'user', 'pass' => 'pass'],
'keys' => [
[
'petstore_auth' => 'default-key',
],
[
'name' => 'basic_auth',
'user' => 'user',
'pass' => 'pass',
],
]
]);
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { VariableOptions } from '../../../../helpers/code-builder';
import type { Client } from '../../../targets';

import { CodeBuilder } from '../../../../helpers/code-builder';
import { escapeForDoubleQuotes, escapeForObjectKey } from '../../../../helpers/escape';
import { escapeForDoubleQuotes } from '../../../../helpers/escape';

export const flask: Client = {
info: {
Expand Down Expand Up @@ -121,7 +121,7 @@ export const flask: Client = {
}
} else {
pushVariable(
`"${escapeForObjectKey(data.name)}": "${escapeForDoubleQuotes(
`"${escapeForDoubleQuotes(data.name)}": "${escapeForDoubleQuotes(
data.default || data.default === '' ? data.default : data.name,
)}",`,
variableOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def webhook():
"name": "",

# OAS Security variables
"petstore_auth": "",
"keys": [
{
"petstore_auth": "",
},
]
},
200,
{"Content-Type": "application/json; charset=utf-8"},
Expand Down
Loading

0 comments on commit fd5a7f5

Please sign in to comment.