Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorbg committed Jan 2, 2024
1 parent 9a43261 commit 31a4316
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 47 deletions.
4 changes: 0 additions & 4 deletions tnoodle-ui/src/main/components/FmcTranslationsDetail.tsx
Expand Up @@ -59,10 +59,6 @@ const FmcTranslationsDetail = ({
const dispatch = useDispatch();

const buildFmcExtension = (selectedTranslations: string[]) => {
if (selectedTranslations.length === 0) {
return null;
}

return {
id: fmcTranslationsExtensionId,
specUrl: "",
Expand Down
2 changes: 1 addition & 1 deletion tnoodle-ui/src/test/App.test.tsx
Expand Up @@ -250,7 +250,7 @@ it("Remove 333, add FMC and MBLD", async () => {
let events = Array.from(container.querySelectorAll("form table"));
const names = [mbldEvent, fmcEvent];

let mbldCubes = "70";
let mbldCubes = 70;

// Pick random indexes from fmc to deselect
let languageKeys = Object.keys(languages);
Expand Down
2 changes: 1 addition & 1 deletion tnoodle-ui/src/test/EventPickerTable.test.tsx
Expand Up @@ -177,7 +177,7 @@ it("Changes in MBLD should go to the store", async () => {
// MBLD should be the last table
const mbldTable = tables[tables.length - 1];
const mbldInputs = mbldTable.querySelectorAll("input");
const newMbldScrambles = "70";
const newMbldScrambles = 70;

await act(async () => {
fireEvent.change(mbldInputs[mbldInputs.length - 1], {
Expand Down
6 changes: 3 additions & 3 deletions tnoodle-ui/src/test/Main.test.tsx
Expand Up @@ -136,8 +136,8 @@ it("There should be only 1 button of type submit, check FMC changes", async () =
// The only submit button must be Generate Scrambles
expect(buttonsTypeSubmit[0].innerHTML).toBe("Generate Scrambles");

// At first, there should be no translation information at all
expect(getFmcLanguageTags(store)).toBeUndefined();
// At first, the default translation selection should be the recommended tags
expect(getFmcLanguageTags(store)).toEqual(suggestedFmcTranslations);

// Select suggested
await act(async () => {
Expand All @@ -151,7 +151,7 @@ it("There should be only 1 button of type submit, check FMC changes", async () =
fireEvent.click(completeButtons[completeButtons.length - 2]);
});

expect(getFmcLanguageTags(store)).toBeUndefined();
expect(getFmcLanguageTags(store)).toEqual([]);

// Select All
await act(async () => {
Expand Down
65 changes: 27 additions & 38 deletions tnoodle-ui/src/test/mock/wca.api.test.mock.ts
Expand Up @@ -362,27 +362,6 @@ export const wcifs: Record<string, Wcif> = {
],
extensions: [],
},
{
id: "333fm",
rounds: [
{
id: "333fm-r1",
format: "m",
timeLimit: null,
extensions: [
{
data: {
numCopies: "1",
},
id: "org.worldcubeassociation.tnoodle.SheetCopyCount",
specUrl: "",
},
],
scrambleSetCount: "1",
},
],
extensions: [],
},
{
id: "333oh",
rounds: [
Expand Down Expand Up @@ -684,11 +663,11 @@ export const wcifs: Record<string, Wcif> = {
extensions: [],
},
{
id: "333mbf",
id: "333fm",
rounds: [
{
id: "333mbf-r1",
format: "2",
id: "333fm-r1",
format: "m",
timeLimit: null,
extensions: [
{
Expand All @@ -702,14 +681,23 @@ export const wcifs: Record<string, Wcif> = {
scrambleSetCount: "1",
},
],
extensions: [],
extensions: [
{
data: {
languageTags: ["de", "es", "pt-BR"],
},
id: "org.worldcubeassociation.tnoodle.FmcLanguages",
specUrl: "",
},
],
},
{
id: "333ft",
id: "333mbf",
rounds: [
{
id: "333ft-r1",
format: "a",
id: "333mbf-r1",
format: "2",
timeLimit: null,
extensions: [
{
data: {
Expand All @@ -718,25 +706,26 @@ export const wcifs: Record<string, Wcif> = {
id: "org.worldcubeassociation.tnoodle.SheetCopyCount",
specUrl: "",
},
],
scrambleSetCount: "1",
},
{
id: "333ft-r2",
format: "a",
extensions: [
{
data: {
numCopies: "1",
requestedScrambles: 60,
},
id: "org.worldcubeassociation.tnoodle.SheetCopyCount",
id: "org.worldcubeassociation.tnoodle.MultiScrambleCount",
specUrl: "",
},
],
scrambleSetCount: "1",
},
],
extensions: [],
extensions: [
{
data: {
requestedScrambles: 60,
},
id: "org.worldcubeassociation.tnoodle.MultiScrambleCount",
specUrl: "",
},
],
},
],
schedule: { numberOfDays: 0, venues: [] },
Expand Down

0 comments on commit 31a4316

Please sign in to comment.