Skip to content

Commit

Permalink
Resolve the fail function with the assert.
Browse files Browse the repository at this point in the history
  • Loading branch information
yoichiro committed Jun 5, 2024
1 parent 37daac9 commit 1882591
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"describe": "readonly",
"test": "readonly",
"expect": "readonly",
"fail": "readonly"
"fail": "readonly",
"assert": "readonly"
}
}
48 changes: 24 additions & 24 deletions src/services/macro/Macro.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ describe('Macro', () => {
).toBeTruthy();
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAny).toBeFalsy();
} else {
fail('actual.macroKeys[0] is not Tap');
assert.fail('actual.macroKeys[0] is not Tap');
}
expect(actual.macroKeys[1].type).toEqual('tap');
if (isTap(actual.macroKeys[1])) {
Expand All @@ -352,7 +352,7 @@ describe('Macro', () => {
expect(actual.macroKeys[1].keyDelayPair.key.keymap.isAscii).toBeFalsy();
expect(actual.macroKeys[1].keyDelayPair.key.keymap.isAny).toBeFalsy();
} else {
fail('actual.macroKeys[1] is not Tap');
assert.fail('actual.macroKeys[1] is not Tap');
}
expect(actual.macroKeys[2].type).toEqual('hold');
if (isHold(actual.macroKeys[2])) {
Expand All @@ -372,7 +372,7 @@ describe('Macro', () => {
actual.macroKeys[2].keyDelayPairs[0].key.keymap.isAny
).toBeFalsy();
} else {
fail('actual.macroKeys[2] is not Hold');
assert.fail('actual.macroKeys[2] is not Hold');
}
});

Expand Down Expand Up @@ -428,7 +428,7 @@ describe('Macro', () => {
).toBeTruthy();
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAny).toBeFalsy();
} else {
fail('actual.macroKeys[0] is not Tap');
assert.fail('actual.macroKeys[0] is not Tap');
}
expect(actual.macroKeys[1].type).toEqual('tap');
if (isTap(actual.macroKeys[1])) {
Expand All @@ -440,7 +440,7 @@ describe('Macro', () => {
expect(actual.macroKeys[1].keyDelayPair.key.keymap.isAny).toBeFalsy();
expect(actual.macroKeys[1].keyDelayPair.delay).toEqual(456);
} else {
fail('actual.macroKeys[1] is not Tap');
assert.fail('actual.macroKeys[1] is not Tap');
}
expect(actual.macroKeys[2].type).toEqual('hold');
if (isHold(actual.macroKeys[2])) {
Expand All @@ -461,7 +461,7 @@ describe('Macro', () => {
).toBeFalsy();
expect(actual.macroKeys[2].keyDelayPairs[0].delay).toEqual(789);
} else {
fail('actual.macroKeys[2] is not Hold');
assert.fail('actual.macroKeys[2] is not Hold');
}
});

Expand Down Expand Up @@ -489,7 +489,7 @@ describe('Macro', () => {
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAscii).toBeFalsy();
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAny).toBeFalsy();
} else {
fail('actual.macroKeys[0] is not Tap');
assert.fail('actual.macroKeys[0] is not Tap');
}
actual = subject.generateMacroKeys('ja-jp');
expect(actual.success).toBeTruthy();
Expand All @@ -503,7 +503,7 @@ describe('Macro', () => {
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAscii).toBeFalsy();
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAny).toBeFalsy();
} else {
fail('actual.macroKeys[0] is not Tap');
assert.fail('actual.macroKeys[0] is not Tap');
}
});

Expand Down Expand Up @@ -545,7 +545,7 @@ describe('Macro', () => {
).toBeTruthy();
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAny).toBeFalsy();
} else {
fail('actual.macroKeys[0] is not Tap');
assert.fail('actual.macroKeys[0] is not Tap');
}
expect(actual.macroKeys[1].type).toEqual('tap');
if (isTap(actual.macroKeys[1])) {
Expand All @@ -558,7 +558,7 @@ describe('Macro', () => {
).toBeTruthy();
expect(actual.macroKeys[1].keyDelayPair.key.keymap.isAny).toBeFalsy();
} else {
fail('actual.macroKeys[1] is not Tap');
assert.fail('actual.macroKeys[1] is not Tap');
}
expect(actual.macroKeys[2].type).toEqual('tap');
if (isTap(actual.macroKeys[2])) {
Expand All @@ -571,7 +571,7 @@ describe('Macro', () => {
).toBeTruthy();
expect(actual.macroKeys[2].keyDelayPair.key.keymap.isAny).toBeTruthy();
} else {
fail('actual.macroKeys[2] is not Tap');
assert.fail('actual.macroKeys[2] is not Tap');
}
});

Expand Down Expand Up @@ -620,7 +620,7 @@ describe('Macro', () => {
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAny).toBeFalsy();
expect(actual.macroKeys[0].keyDelayPair.delay).toEqual(123);
} else {
fail('actual.macroKeys[0] is not Tap');
assert.fail('actual.macroKeys[0] is not Tap');
}
expect(actual.macroKeys[1].type).toEqual('tap');
if (isTap(actual.macroKeys[1])) {
Expand All @@ -634,7 +634,7 @@ describe('Macro', () => {
expect(actual.macroKeys[1].keyDelayPair.key.keymap.isAny).toBeFalsy();
expect(actual.macroKeys[1].keyDelayPair.delay).toEqual(456);
} else {
fail('actual.macroKeys[1] is not Tap');
assert.fail('actual.macroKeys[1] is not Tap');
}
expect(actual.macroKeys[2].type).toEqual('tap');
if (isTap(actual.macroKeys[2])) {
Expand All @@ -648,7 +648,7 @@ describe('Macro', () => {
expect(actual.macroKeys[2].keyDelayPair.key.keymap.isAny).toBeTruthy();
expect(actual.macroKeys[2].keyDelayPair.delay).toEqual(789);
} else {
fail('actual.macroKeys[2] is not Tap');
assert.fail('actual.macroKeys[2] is not Tap');
}
});

Expand Down Expand Up @@ -682,7 +682,7 @@ describe('Macro', () => {
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAscii).toBeFalsy();
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAny).toBeFalsy();
} else {
fail('actual.macroKeys[0] is not Tap');
assert.fail('actual.macroKeys[0] is not Tap');
}
expect(actual.macroKeys[1].type).toEqual('tap');
if (isTap(actual.macroKeys[1])) {
Expand All @@ -693,7 +693,7 @@ describe('Macro', () => {
expect(actual.macroKeys[1].keyDelayPair.key.keymap.isAscii).toBeFalsy();
expect(actual.macroKeys[1].keyDelayPair.key.keymap.isAny).toBeFalsy();
} else {
fail('actual.macroKeys[1] is not Tap');
assert.fail('actual.macroKeys[1] is not Tap');
}
expect(actual.macroKeys[2].type).toEqual('tap');
if (isTap(actual.macroKeys[2])) {
Expand All @@ -704,7 +704,7 @@ describe('Macro', () => {
expect(actual.macroKeys[2].keyDelayPair.key.keymap.isAscii).toBeFalsy();
expect(actual.macroKeys[2].keyDelayPair.key.keymap.isAny).toBeFalsy();
} else {
fail('actual.macroKeys[2] is not Tap');
assert.fail('actual.macroKeys[2] is not Tap');
}
});

Expand Down Expand Up @@ -757,7 +757,7 @@ describe('Macro', () => {
expect(actual.macroKeys[0].keyDelayPair.key.keymap.isAny).toBeFalsy();
expect(actual.macroKeys[0].keyDelayPair.delay).toEqual(123);
} else {
fail('actual.macroKeys[0] is not Tap');
assert.fail('actual.macroKeys[0] is not Tap');
}
expect(actual.macroKeys[1].type).toEqual('tap');
if (isTap(actual.macroKeys[1])) {
Expand All @@ -769,7 +769,7 @@ describe('Macro', () => {
expect(actual.macroKeys[1].keyDelayPair.key.keymap.isAny).toBeFalsy();
expect(actual.macroKeys[1].keyDelayPair.delay).toEqual(456);
} else {
fail('actual.macroKeys[1] is not Tap');
assert.fail('actual.macroKeys[1] is not Tap');
}
expect(actual.macroKeys[2].type).toEqual('tap');
if (isTap(actual.macroKeys[2])) {
Expand All @@ -781,7 +781,7 @@ describe('Macro', () => {
expect(actual.macroKeys[2].keyDelayPair.key.keymap.isAny).toBeFalsy();
expect(actual.macroKeys[2].keyDelayPair.delay).toEqual(789);
} else {
fail('actual.macroKeys[2] is not Tap');
assert.fail('actual.macroKeys[2] is not Tap');
}
});

Expand Down Expand Up @@ -847,7 +847,7 @@ describe('Macro', () => {
actual.macroKeys[0].keyDelayPairs[1].key.keymap.isAny
).toBeFalsy();
} else {
fail('actual.macroKeys[0] is not Hold');
assert.fail('actual.macroKeys[0] is not Hold');
}
expect(actual.macroKeys[1].type).toEqual('hold');
if (isHold(actual.macroKeys[1])) {
Expand All @@ -867,7 +867,7 @@ describe('Macro', () => {
actual.macroKeys[1].keyDelayPairs[0].key.keymap.isAny
).toBeFalsy();
} else {
fail('actual.macroKeys[1] is not Hold');
assert.fail('actual.macroKeys[1] is not Hold');
}
});

Expand Down Expand Up @@ -953,7 +953,7 @@ describe('Macro', () => {
).toBeFalsy();
expect(actual.macroKeys[0].keyDelayPairs[1].delay).toEqual(456);
} else {
fail('actual.macroKeys[0] is not Hold');
assert.fail('actual.macroKeys[0] is not Hold');
}
expect(actual.macroKeys[1].type).toEqual('hold');
if (isHold(actual.macroKeys[1])) {
Expand All @@ -974,7 +974,7 @@ describe('Macro', () => {
).toBeFalsy();
expect(actual.macroKeys[1].keyDelayPairs[0].delay).toEqual(789);
} else {
fail('actual.macroKeys[1] is not Hold');
assert.fail('actual.macroKeys[1] is not Hold');
}
});

Expand Down

0 comments on commit 1882591

Please sign in to comment.