-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 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,29 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import {TabTypes, type TabType} from '.'; | ||
|
||
describe('TabTypes', () => { | ||
it('should create a mirrored object with keys equal to their values', () => { | ||
expect(TabTypes).toEqual({ | ||
MESSAGES: 'MESSAGES', | ||
FILES: 'FILES', | ||
}); | ||
}); | ||
|
||
it('should allow valid keys for TabType', () => { | ||
const validTabType1: TabType = 'MESSAGES'; | ||
const validTabType2: TabType = 'FILES'; | ||
|
||
// Ensure that validTabType1 and validTabType2 match the types in TabTypes | ||
expect(validTabType1).toBe('MESSAGES'); | ||
expect(validTabType2).toBe('FILES'); | ||
}); | ||
|
||
it('should not allow invalid keys for TabType', () => { | ||
// TypeScript will catch this as an error, but we can simulate with a custom runtime check | ||
const invalidTabType = 'INVALID_TAB_TYPE' as TabType; | ||
|
||
expect(TabTypes[invalidTabType]).toBeUndefined(); // Simulate invalid key behavior | ||
}); | ||
}); |