Skip to content

Commit

Permalink
Merge pull request #1218 from OneSignal/setLanguage-test
Browse files Browse the repository at this point in the history
test: add User setLanguage test
  • Loading branch information
sherwinski authored Jan 16, 2025
2 parents 30c4265 + 06edf7e commit 39e4881
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions __test__/unit/user/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,19 @@ describe('User tests', () => {

expect(language).toBe(languageSample);
});

test('setLanguage should call the properties model set method', async () => {
await TestEnvironment.initialize();

const languageSample = 'fr';

const propertyModel = getDummyPropertyOSModel();
const setLanguageSpy = jest.spyOn(propertyModel, 'set');
OneSignal.coreDirector.add(ModelName.Properties, propertyModel);

const user = User.createOrGetInstance();
user.setLanguage(languageSample);

expect(setLanguageSpy).toHaveBeenCalledWith('language', languageSample);
});
});

0 comments on commit 39e4881

Please sign in to comment.