diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-10-10 01:42:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-10 01:42:37 +0000 |
commit | dfcefe1b84cc96ead1c8d8f9aa65ff05ccd70378 (patch) | |
tree | 12f1a4ed6da8fd96c034d23bcf08b1535bca1113 /test/shared/settings/Key.test.ts | |
parent | 24f4f06db6572d81cadfe191f36c433a79985871 (diff) | |
parent | 039095e18562c44edda2c5a83a3d82c2e220b370 (diff) |
Merge pull request #1267 from ueokande/move-to-jest
Move to Jest
Diffstat (limited to 'test/shared/settings/Key.test.ts')
-rw-r--r-- | test/shared/settings/Key.test.ts | 95 |
1 files changed, 47 insertions, 48 deletions
diff --git a/test/shared/settings/Key.test.ts b/test/shared/settings/Key.test.ts index 47af1d9..8ad9265 100644 --- a/test/shared/settings/Key.test.ts +++ b/test/shared/settings/Key.test.ts @@ -1,89 +1,88 @@ -import { expect } from "chai"; import Key from "../../../src/shared/settings/Key"; describe("Key", () => { describe("fromMapKey", () => { it("return for X", () => { const key = Key.fromMapKey("x"); - expect(key.key).to.equal("x"); - expect(key.shift).to.be.false; - expect(key.ctrl).to.be.false; - expect(key.alt).to.be.false; - expect(key.meta).to.be.false; + expect(key.key).toEqual("x"); + expect(key.shift).toBeFalsy; + expect(key.ctrl).toBeFalsy; + expect(key.alt).toBeFalsy; + expect(key.meta).toBeFalsy; }); it("return for Shift+X", () => { const key = Key.fromMapKey("X"); - expect(key.key).to.equal("X"); - expect(key.shift).to.be.true; - expect(key.ctrl).to.be.false; - expect(key.alt).to.be.false; - expect(key.meta).to.be.false; + expect(key.key).toEqual("X"); + expect(key.shift).toBeTruthy; + expect(key.ctrl).toBeFalsy; + expect(key.alt).toBeFalsy; + expect(key.meta).toBeFalsy; }); it("return for Ctrl+X", () => { const key = Key.fromMapKey("<C-X>"); - expect(key.key).to.equal("x"); - expect(key.shift).to.be.false; - expect(key.ctrl).to.be.true; - expect(key.alt).to.be.false; - expect(key.meta).to.be.false; + expect(key.key).toEqual("x"); + expect(key.shift).toBeFalsy; + expect(key.ctrl).toBeTruthy; + expect(key.alt).toBeFalsy; + expect(key.meta).toBeFalsy; }); it("returns for Ctrl+Meta+X", () => { const key = Key.fromMapKey("<C-M-X>"); - expect(key.key).to.equal("x"); - expect(key.shift).to.be.false; - expect(key.ctrl).to.be.true; - expect(key.alt).to.be.false; - expect(key.meta).to.be.true; + expect(key.key).toEqual("x"); + expect(key.shift).toBeFalsy; + expect(key.ctrl).toBeTruthy; + expect(key.alt).toBeFalsy; + expect(key.meta).toBeTruthy; }); it("returns for Ctrl+Shift+x", () => { const key = Key.fromMapKey("<C-S-x>"); - expect(key.key).to.equal("X"); - expect(key.shift).to.be.true; - expect(key.ctrl).to.be.true; - expect(key.alt).to.be.false; - expect(key.meta).to.be.false; + expect(key.key).toEqual("X"); + expect(key.shift).toBeTruthy; + expect(key.ctrl).toBeTruthy; + expect(key.alt).toBeFalsy; + expect(key.meta).toBeFalsy; }); it("returns for Shift+Esc", () => { const key = Key.fromMapKey("<S-Esc>"); - expect(key.key).to.equal("Esc"); - expect(key.shift).to.be.true; - expect(key.ctrl).to.be.false; - expect(key.alt).to.be.false; - expect(key.meta).to.be.false; + expect(key.key).toEqual("Esc"); + expect(key.shift).toBeTruthy; + expect(key.ctrl).toBeFalsy; + expect(key.alt).toBeFalsy; + expect(key.meta).toBeFalsy; }); it("returns for Ctrl+Esc", () => { const key = Key.fromMapKey("<C-Esc>"); - expect(key.key).to.equal("Esc"); - expect(key.shift).to.be.false; - expect(key.ctrl).to.be.true; - expect(key.alt).to.be.false; - expect(key.meta).to.be.false; + expect(key.key).toEqual("Esc"); + expect(key.shift).toBeFalsy; + expect(key.ctrl).toBeTruthy; + expect(key.alt).toBeFalsy; + expect(key.meta).toBeFalsy; }); it("returns for Ctrl+Esc", () => { const key = Key.fromMapKey("<C-Space>"); - expect(key.key).to.equal("Space"); - expect(key.shift).to.be.false; - expect(key.ctrl).to.be.true; - expect(key.alt).to.be.false; - expect(key.meta).to.be.false; + expect(key.key).toEqual("Space"); + expect(key.shift).toBeFalsy; + expect(key.ctrl).toBeTruthy; + expect(key.alt).toBeFalsy; + expect(key.meta).toBeFalsy; }); }); describe("idDigit", () => { it("returns true if the key is a digit", () => { - expect(new Key({ key: "0" }).isDigit()).to.be.true; - expect(new Key({ key: "9" }).isDigit()).to.be.true; - expect(new Key({ key: "9", alt: true }).isDigit()).to.be.false; + expect(new Key({ key: "0" }).isDigit()).toBeTruthy; + expect(new Key({ key: "9" }).isDigit()).toBeTruthy; + expect(new Key({ key: "9", alt: true }).isDigit()).toBeFalsy; - expect(new Key({ key: "a" }).isDigit()).to.be.false; - expect(new Key({ key: "0" }).isDigit()).to.be.false; + expect(new Key({ key: "a" }).isDigit()).toBeFalsy; + expect(new Key({ key: "0" }).isDigit()).toBeFalsy; }); }); @@ -105,7 +104,7 @@ describe("Key", () => { meta: false, }) ) - ).to.be.true; + ).toBeTruthy; expect( new Key({ @@ -123,7 +122,7 @@ describe("Key", () => { meta: false, }) ) - ).to.be.false; + ).toBeFalsy; }); }); }); |