Skip to content

Commit

Permalink
Use arguments as name for function parameters (#8)
Browse files Browse the repository at this point in the history
* Use arguments as name for function parameters

* Bump version
  • Loading branch information
abdala authored Oct 8, 2024
1 parent d746ecb commit 490e277
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 38 deletions.
2 changes: 1 addition & 1 deletion assert/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/assert",
"version": "0.3.0",
"version": "0.3.1",
"description": "Extra assert library",
"type": "module",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion dtc-aws-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-aws-plugin",
"version": "0.3.0",
"version": "0.3.1",
"description": "AWS plugin for Declarative TestCases",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion dtc-mysql-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-mysql-plugin",
"version": "0.3.0",
"version": "0.3.1",
"description": "MySQL plugin for Declarative TestCases",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion dtc-mysql-plugin/test/fixtures/mock-invalid-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {
act: {
import: 'query',
from: './mysql.ts',
attributes: [
arguments: [
{
var: 'value',
},
Expand Down
2 changes: 1 addition & 1 deletion dtc-mysql-plugin/test/fixtures/mock-two-connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default {
act: {
import: 'queryTwo',
from: './mysql.ts',
attributes: [
arguments: [
{
var: 'value',
},
Expand Down
2 changes: 1 addition & 1 deletion dtc-mysql-plugin/test/fixtures/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
act: {
import: 'query',
from: './mysql.ts',
attributes: [
arguments: [
{
var: 'value',
},
Expand Down
2 changes: 1 addition & 1 deletion dtc-playwright-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-playwright-plugin",
"version": "0.3.0",
"version": "0.3.1",
"description": "Playwright plugin for Declarative TestCases",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion dtc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc",
"version": "0.3.0",
"version": "0.3.1",
"description": "Declarative TestCases",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions dtc/src/plugins/FunctionCallPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {isRecord} from '../utils.js'
type FunctionCallAct = {
import: string
from: string
attributes?: unknown[]
arguments?: unknown[]
}

const isFunctionCallAct = (v: unknown): v is FunctionCallAct => typeof v === 'object' && v !== null && 'import' in v
Expand All @@ -31,7 +31,7 @@ export class FunctionCallPlugin implements Plugin {
}
/* c8 ignore end */

this.response = await module[args.import].apply(null, args.attributes)
this.response = await module[args.import].apply(null, args.arguments)
}

assert(args: unknown) {
Expand Down
2 changes: 1 addition & 1 deletion dtc/test/fixtures/t1.dtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
act: {
import: 'syncFunction',
from: 'functions.js',
attributes: [{a: 'b'}],
arguments: [{a: 'b'}],
},
assert: {
a: 'b',
Expand Down
2 changes: 1 addition & 1 deletion dtc/test/fixtures/t2.dtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
act: {
import: 'syncFunction',
from: 'functions.js',
attributes: [{a: 'b'}],
arguments: [{a: 'b'}],
},
assert: {
a: 'b',
Expand Down
2 changes: 1 addition & 1 deletion dtc/test/fixtures/tests/t3.dtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
act: {
import: 'syncFunction',
from: '../functions.js',
attributes: [{a: 'b'}],
arguments: [{a: 'b'}],
},
assert: {
a: 'b',
Expand Down
2 changes: 1 addition & 1 deletion dtc/test/fixtures/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
act: {
import: 'syncFunction',
from: './functions.js',
attributes: [
arguments: [
{a: 'b'}
]
},
Expand Down
12 changes: 6 additions & 6 deletions dtc/test/plugins/FunctionCallPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@ test('It call a sync function without args', async () => {

test('It call a sync function with args', async () => {
const functionCallPlugin = new FunctionCallPlugin(__dirname)
const attributes = {a: 'b'}
const args = {a: 'b'}

await functionCallPlugin.act({
import: 'syncFunction',
from: '../fixtures/functions.js',
attributes: [attributes],
arguments: [args],
})

functionCallPlugin.assert(attributes)
functionCallPlugin.assert(args)
})

test('It call a async function with args', async () => {
const functionCallPlugin = new FunctionCallPlugin(__dirname)
const attributes = {a: 'b'}
const args = {a: 'b'}

await functionCallPlugin.act({
import: 'asyncFunction',
from: '../fixtures/functions.js',
attributes: [attributes],
arguments: [args],
})

functionCallPlugin.assert(attributes)
functionCallPlugin.assert(args)
})
2 changes: 1 addition & 1 deletion nock-aws/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/nock-aws",
"version": "0.3.0",
"version": "0.3.1",
"description": "AWS Request mocker based on Nock",
"repository": {
"type": "git",
Expand Down
23 changes: 7 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion yaml/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/yaml",
"version": "0.3.0",
"version": "0.3.1",
"description": "YAML parser with extra tags",
"repository": {
"type": "git",
Expand Down

0 comments on commit 490e277

Please sign in to comment.