-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from i-VRESSE/toggleresidue
Moved toggleResidue from webap to ui
- Loading branch information
Showing
3 changed files
with
149 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import { describe, expect, test } from "vitest"; | ||
import { toggleResidue } from "./toggles.js"; | ||
|
||
describe("toggleResidue()", () => { | ||
test("give residue in pick act mode should add residue to active", () => { | ||
const residue = 42; | ||
const residueState = { | ||
act: [], | ||
pass: [], | ||
}; | ||
|
||
const result = toggleResidue(residue, "act", residueState); | ||
|
||
expect(result).toEqual({ | ||
act: [42], | ||
pass: [], | ||
}); | ||
}); | ||
|
||
test("give residue in pick pass mode should add residue to passive", () => { | ||
const residue = 42; | ||
const residueState = { | ||
act: [], | ||
pass: [], | ||
}; | ||
|
||
const result = toggleResidue(residue, "pass", residueState); | ||
|
||
expect(result).toEqual({ | ||
act: [], | ||
pass: [42], | ||
}); | ||
}); | ||
|
||
test("give residue in pick act mode should remove residue from active", () => { | ||
const residue = 42; | ||
const residueState = { | ||
act: [42], | ||
pass: [], | ||
}; | ||
|
||
const result = toggleResidue(residue, "act", residueState); | ||
|
||
expect(result).toEqual({ | ||
act: [], | ||
pass: [], | ||
}); | ||
}); | ||
|
||
test("give residue in pick pass mode should remove residue from passive", () => { | ||
const residue = 42; | ||
const residueState = { | ||
act: [], | ||
pass: [42], | ||
}; | ||
|
||
const result = toggleResidue(residue, "pass", residueState); | ||
|
||
expect(result).toEqual({ | ||
act: [], | ||
pass: [], | ||
}); | ||
}); | ||
|
||
test("give residue in pick act mode should remove residue from passive", () => { | ||
const residue = 42; | ||
const residueState = { | ||
act: [], | ||
pass: [42], | ||
}; | ||
|
||
const result = toggleResidue(residue, "act", residueState); | ||
|
||
expect(result).toEqual({ | ||
act: [42], | ||
pass: [], | ||
}); | ||
}); | ||
|
||
test("give residue in pick pass mode should remove residue from active", () => { | ||
const residue = 42; | ||
const residueState = { | ||
act: [42], | ||
pass: [], | ||
}; | ||
|
||
const result = toggleResidue(residue, "pass", residueState); | ||
|
||
expect(result).toEqual({ | ||
act: [], | ||
pass: [42], | ||
}); | ||
}); | ||
|
||
test("should keep current selection", () => { | ||
const residue = 41; | ||
const residueState = { | ||
act: [42], | ||
pass: [43], | ||
}; | ||
|
||
const result = toggleResidue(residue, "act", residueState); | ||
|
||
expect(result).toEqual({ | ||
act: [42, 41], | ||
pass: [43], | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters