-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added small suite of tests to validate defaults.js using Jest - MR
- Loading branch information
Showing
7 changed files
with
2,598 additions
and
180 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { defaultValues, createDefaultLevelsObject, createDefaultBranch, createDefaultBranchesObject } from '../app/utilities/defaults'; | ||
|
||
describe('Default Branches Setup', () => { | ||
it('is defaulted to first frame of video', () => { | ||
expect(defaultValues.time).toBe("00:00.01"); | ||
}); | ||
|
||
|
||
it('creates a branch properly', () => { | ||
const expectedBranch = { | ||
start: "00:00.01", | ||
end: "00:00.01", | ||
enabled: true, | ||
outcome: "0" | ||
}; | ||
|
||
expect(createDefaultBranch()).toEqual(expectedBranch); | ||
}); | ||
|
||
it('creates an object with 6 emotion branches', () => { | ||
const defaultBranch = { | ||
start: "00:00.01", | ||
end: "00:00.01", | ||
enabled: true, | ||
outcome: "0" | ||
}; | ||
|
||
const expected = { | ||
"Anger": defaultBranch, | ||
"Fear": defaultBranch, | ||
"Calm": defaultBranch, | ||
"Disgust": defaultBranch, | ||
"Contempt": defaultBranch, | ||
"Surprise": defaultBranch | ||
}; | ||
|
||
expect(createDefaultBranchesObject()).toEqual(expected); | ||
}); | ||
|
||
}); | ||
|
||
describe('Default Levels Setup', () => { | ||
it ('is expected to create an empty object', () => { | ||
expect(createDefaultLevelsObject(0)).toEqual({}); | ||
}); | ||
|
||
it ('is expected to return empty object with negative input', () => { | ||
expect(createDefaultLevelsObject(-3)).toEqual({}); | ||
}); | ||
|
||
it('is expected to create an object with one level', () => { | ||
const oneLevel = { | ||
1: { | ||
level: 1, | ||
start: "00:00.01", | ||
end: "00:00.01", | ||
branches: createDefaultBranchesObject() | ||
} | ||
}; | ||
|
||
expect(createDefaultLevelsObject(1)).toEqual(oneLevel); | ||
}); | ||
|
||
it('is expected to create an object with 3 levels', () => { | ||
const threeLevels = { | ||
1: { | ||
level: 1, | ||
start: "00:00.01", | ||
end: "00:00.01", | ||
branches: createDefaultBranchesObject() | ||
}, | ||
2: { | ||
level: 2, | ||
start: "00:00.01", | ||
end: "00:00.01", | ||
branches: createDefaultBranchesObject() | ||
}, | ||
3: { | ||
level: 3, | ||
start: "00:00.01", | ||
end: "00:00.01", | ||
branches: createDefaultBranchesObject() | ||
} | ||
}; | ||
|
||
expect(createDefaultLevelsObject(3)).toEqual(threeLevels); | ||
}); | ||
}); |
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
Oops, something went wrong.