Skip to content

Commit

Permalink
test for action.js
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-wedensday committed Apr 9, 2024
1 parent 6dba9cf commit aafd61d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/components/atoms/LanguageProvider/tests/action.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { changeLocale } from '../actions';
import { CHANGE_LOCALE } from '../constants'; // Import your action creator and action type

// Test suite for the changeLocale action creator
describe('changeLocale action creator', () => {
it('should create an action to change the locale', () => {
// Define the expected language locale
const languageLocale = 'fr';
// Expected action object to be returned
const expectedAction = {
type: CHANGE_LOCALE,
locale: languageLocale
};
// Call the changeLocale action creator with a languageLocale argument
const action = changeLocale(languageLocale);
// Assert that the action creator returns the correct action
expect(action).toEqual(expectedAction);
});
});

0 comments on commit aafd61d

Please sign in to comment.