Skip to content

Commit

Permalink
feat: validation enums
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtrindade committed Dec 29, 2023
1 parent 45dffb8 commit c012016
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/util/enum/ActionType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enum ActionType {
BUTTOM = 'buttom',
REMINDER = 'reminder',
TIMER = 'timer'
}

export default ActionType
7 changes: 7 additions & 0 deletions src/util/enum/NotificationType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enum NotificationType {
POPUP = 'popup',
BALLOON = 'balloon',
SILENT = 'silent'
}

export default NotificationType
7 changes: 7 additions & 0 deletions src/util/enum/SpeechType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enum SpeechType {
MALE = 'male',
FEMALE = 'female',
NEUTRAL = 'neutral'
}

export default SpeechType
6 changes: 6 additions & 0 deletions src/util/enum/Theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
enum Theme {
DARK = 'dark',
LIGHT = 'light'
}

export default Theme
21 changes: 21 additions & 0 deletions test/unit/util/enum/ActionType.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import ActionType from 'src/util/enum/ActionType'

describe(':: Util :: Enum :: ActionType ::', () => {
it('should return expected keys', () => {
const enumKeys = Object.keys(ActionType)
const keys = ['BUTTOM', 'REMINDER', 'TIMER']

enumKeys.forEach((key, index) => {
expect(key).toBe(keys[index])
})
})

it('should return expected values', () => {
const enumValues = Object.values(ActionType)
const values = ['buttom', 'reminder', 'timer']

enumValues.forEach((value, index) => {
expect(value).toBe(values[index])
})
})
})
21 changes: 21 additions & 0 deletions test/unit/util/enum/NotificationType.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import NotificationType from 'src/util/enum/NotificationType'

describe(':: Util :: Enum :: NotificationType ::', () => {
it('should return expected keys', () => {
const enumKeys = Object.keys(NotificationType)
const keys = ['POPUP', 'BALLOON', 'SILENT']

enumKeys.forEach((key, index) => {
expect(key).toBe(keys[index])
})
})

it('should return expected values', () => {
const enumValues = Object.values(NotificationType)
const values = ['popup', 'balloon', 'silent']

enumValues.forEach((value, index) => {
expect(value).toBe(values[index])
})
})
})
21 changes: 21 additions & 0 deletions test/unit/util/enum/SpeechType.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import SpeechType from 'src/util/enum/SpeechType'

describe(':: Util :: Enum :: SpeechType ::', () => {
it('should return expected keys', () => {
const enumKeys = Object.keys(SpeechType)
const keys = ['MALE', 'FEMALE', 'NEUTRAL']

enumKeys.forEach((key, index) => {
expect(key).toBe(keys[index])
})
})

it('should return expected values', () => {
const enumValues = Object.values(SpeechType)
const values = ['male', 'female', 'neutral']

enumValues.forEach((value, index) => {
expect(value).toBe(values[index])
})
})
})
21 changes: 21 additions & 0 deletions test/unit/util/enum/Theme.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Theme from 'src/util/enum/Theme'

describe(':: Util :: Enum :: Theme ::', () => {
it('should return expected keys', () => {
const enumKeys = Object.keys(Theme)
const keys = ['DARK', 'LIGHT']

enumKeys.forEach((key, index) => {
expect(key).toBe(keys[index])
})
})

it('should return expected values', () => {
const enumValues = Object.values(Theme)
const values = ['dark', 'light']

enumValues.forEach((value, index) => {
expect(value).toBe(values[index])
})
})
})

0 comments on commit c012016

Please sign in to comment.