Skip to content

Commit

Permalink
feat(test): improved code style
Browse files Browse the repository at this point in the history
  • Loading branch information
fenying committed Jun 14, 2023
1 parent 0e4c520 commit a5864f1
Show file tree
Hide file tree
Showing 10 changed files with 1,451 additions and 1,451 deletions.
1,032 changes: 516 additions & 516 deletions src/test/01-elemental-types.ts

Large diffs are not rendered by default.

72 changes: 36 additions & 36 deletions src/test/02-array-and-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ const testItems: ITestSuite = {
'rule': ['$.list', 'string'],
'items': [
{
inputName: '[string]',
inputValue: ['fff'],
title: '[string]',
value: ['fff'],
expect: true
},
{
inputName: '[string,string]',
inputValue: ['fff', 'ggg'],
title: '[string,string]',
value: ['fff', 'ggg'],
expect: true
},
{
inputName: '[string,int]',
inputValue: ['fff', 123],
title: '[string,int]',
value: ['fff', 123],
expect: false
},
...defaultItems({
Expand All @@ -56,13 +56,13 @@ const testItems: ITestSuite = {
'rule': ['$.array', 1, 'string'],
'items': [
{
inputName: '[string]',
inputValue: ['fff'],
title: '[string]',
value: ['fff'],
expect: true
},
{
inputName: '[string,string]',
inputValue: ['fff', 'ggg'],
title: '[string,string]',
value: ['fff', 'ggg'],
expect: false
},
...defaultItems({})
Expand All @@ -73,28 +73,28 @@ const testItems: ITestSuite = {
'rule': ['$.array', 2, 'string', 'int'],
'items': [
{
inputName: '[string]',
inputValue: ['fff'],
title: '[string]',
value: ['fff'],
expect: false
},
{
inputName: '[string,string]',
inputValue: ['fff', 'ggg'],
title: '[string,string]',
value: ['fff', 'ggg'],
expect: true
},
{
inputName: '[string,int]',
inputValue: ['fff', 312],
title: '[string,int]',
value: ['fff', 312],
expect: true
},
{
inputName: '[int,int]',
inputValue: [333, 312],
title: '[int,int]',
value: [333, 312],
expect: true
},
{
inputName: '[int,string]',
inputValue: [333, 'ddsadsa'],
title: '[int,string]',
value: [333, 'ddsadsa'],
expect: true
},
...defaultItems({})
Expand All @@ -105,18 +105,18 @@ const testItems: ITestSuite = {
'rule': ['$.array', [1], 'string'],
'items': [
{
inputName: '[string]',
inputValue: ['fff'],
title: '[string]',
value: ['fff'],
expect: true
},
{
inputName: '[string,string]',
inputValue: ['fff', 'ggg'],
title: '[string,string]',
value: ['fff', 'ggg'],
expect: true
},
{
inputName: '[string,int]',
inputValue: ['fff', 123],
title: '[string,int]',
value: ['fff', 123],
expect: false
},
...defaultItems({})
Expand All @@ -127,28 +127,28 @@ const testItems: ITestSuite = {
'rule': ['$.array', [1, 3], 'string'],
'items': [
{
inputName: '[string]',
inputValue: ['fff'],
title: '[string]',
value: ['fff'],
expect: true
},
{
inputName: '[string,string]',
inputValue: ['fff', 'ggg'],
title: '[string,string]',
value: ['fff', 'ggg'],
expect: true
},
{
inputName: '[string,string,string]',
inputValue: ['fff', 'ggg', 'ggg'],
title: '[string,string,string]',
value: ['fff', 'ggg', 'ggg'],
expect: true
},
{
inputName: '[string,string,string,string]',
inputValue: ['fff', 'ggg', 'ggg', 'fffa'],
title: '[string,string,string,string]',
value: ['fff', 'ggg', 'ggg', 'fffa'],
expect: false
},
{
inputName: '[string,int]',
inputValue: ['fff', 123],
title: '[string,int]',
value: ['fff', 123],
expect: false
},
...defaultItems({})
Expand Down
104 changes: 52 additions & 52 deletions src/test/03-tuple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ const testItems: ITestSuite = {
'rule': ['$.tuple', 'string', 'int'],
'items': [
{
inputName: '[string]',
inputValue: ['fff'],
title: '[string]',
value: ['fff'],
expect: false
},
{
inputName: '[string,int]',
inputValue: ['fff', 1213],
title: '[string,int]',
value: ['fff', 1213],
expect: true
},
{
inputName: '[int, string]',
inputValue: [123, 'fff'],
title: '[int, string]',
value: [123, 'fff'],
expect: false
},
...defaultItems({
Expand All @@ -50,18 +50,18 @@ const testItems: ITestSuite = {
'rule': ['$.tuple'],
'items': [
{
inputName: '[string]',
inputValue: ['fff'],
title: '[string]',
value: ['fff'],
expect: false
},
{
inputName: '[string,int]',
inputValue: ['fff', 1213],
title: '[string,int]',
value: ['fff', 1213],
expect: false
},
{
inputName: '[int, string]',
inputValue: [123, 'fff'],
title: '[int, string]',
value: [123, 'fff'],
expect: false
},
...defaultItems({
Expand All @@ -74,23 +74,23 @@ const testItems: ITestSuite = {
'rule': ['$.tuple', 'string', 'int', '...'],
'items': [
{
inputName: '[string]',
inputValue: ['fff'],
title: '[string]',
value: ['fff'],
expect: true
},
{
inputName: '[string,int]',
inputValue: ['fff', 1213],
title: '[string,int]',
value: ['fff', 1213],
expect: true
},
{
inputName: '[string,int,int]',
inputValue: ['fff', 1213, 233],
title: '[string,int,int]',
value: ['fff', 1213, 233],
expect: true
},
{
inputName: '[int, string]',
inputValue: [123, 'fff'],
title: '[int, string]',
value: [123, 'fff'],
expect: false
},
...defaultItems({
Expand All @@ -103,28 +103,28 @@ const testItems: ITestSuite = {
'rule': ['$.tuple', 'string', 'int', '...3', 'string'],
'items': [
{
inputName: '[string,int,int,int,string]',
inputValue: ['fff', 1, 3, 5, 'ccc'],
title: '[string,int,int,int,string]',
value: ['fff', 1, 3, 5, 'ccc'],
expect: true
},
{
inputName: '[string,int]',
inputValue: ['fff', 1213],
title: '[string,int]',
value: ['fff', 1213],
expect: false
},
{
inputName: '[string,int,string]',
inputValue: ['fff', 1213, 'ccc'],
title: '[string,int,string]',
value: ['fff', 1213, 'ccc'],
expect: false
},
{
inputName: '[string,int,int]',
inputValue: ['fff', 1213, 233],
title: '[string,int,int]',
value: ['fff', 1213, 233],
expect: false
},
{
inputName: '[int, string]',
inputValue: [123, 'fff'],
title: '[int, string]',
value: [123, 'fff'],
expect: false
},
...defaultItems({
Expand All @@ -137,43 +137,43 @@ const testItems: ITestSuite = {
'rule': ['$.tuple', 'string', 'int', '...4', 'string', '...'],
'items': [
{
inputName: '[string,int,int,int,int,string]',
inputValue: ['fff', 1, 3, 5, 2, 'ccc'],
title: '[string,int,int,int,int,string]',
value: ['fff', 1, 3, 5, 2, 'ccc'],
expect: true
},
{
inputName: '[string,int,int,int,int,string,string]',
inputValue: ['fff', 1, 3, 5, 2, 'ccc', 'aaa'],
title: '[string,int,int,int,int,string,string]',
value: ['fff', 1, 3, 5, 2, 'ccc', 'aaa'],
expect: true
},
{
inputName: '[string,int,int,int,int]',
inputValue: ['fff', 1, 3, 5, 2],
title: '[string,int,int,int,int]',
value: ['fff', 1, 3, 5, 2],
expect: true
},
{
inputName: '[string,int,int,int]',
inputValue: ['fff', 1, 3, 5],
title: '[string,int,int,int]',
value: ['fff', 1, 3, 5],
expect: false
},
{
inputName: '[string,int]',
inputValue: ['fff', 1213],
title: '[string,int]',
value: ['fff', 1213],
expect: false
},
{
inputName: '[string,int,string]',
inputValue: ['fff', 1213, 'ccc'],
title: '[string,int,string]',
value: ['fff', 1213, 'ccc'],
expect: false
},
{
inputName: '[string,int,int]',
inputValue: ['fff', 1213, 233],
title: '[string,int,int]',
value: ['fff', 1213, 233],
expect: false
},
{
inputName: '[int, string]',
inputValue: [123, 'fff'],
title: '[int, string]',
value: [123, 'fff'],
expect: false
},
...defaultItems({
Expand All @@ -186,8 +186,8 @@ const testItems: ITestSuite = {
'rule': ['$.tuple', '...'],
'items': [
{
inputName: 'any',
inputValue: 'any',
title: 'any',
value: 'any',
expect: 'throw'
}
]
Expand All @@ -197,8 +197,8 @@ const testItems: ITestSuite = {
'rule': ['$.tuple', 'string', '...', '...'],
'items': [
{
inputName: 'any',
inputValue: 'any',
title: 'any',
value: 'any',
expect: 'throw'
}
]
Expand All @@ -208,8 +208,8 @@ const testItems: ITestSuite = {
'rule': ['$.tuple', 'string', '...d'],
'items': [
{
inputName: 'any',
inputValue: 'any',
title: 'any',
value: 'any',
expect: 'throw'
}
]
Expand Down
Loading

0 comments on commit a5864f1

Please sign in to comment.