leangseu edx/confirm email banner (#4)
* chore: working ui for confirm email * test: update unit test * chore: implement get values for state test * chore: update formatMessage test to support more than primitive variable
This commit is contained in:
@@ -10,6 +10,11 @@ export const formatMessage = (msg, values) => {
|
||||
if (values === undefined) {
|
||||
return message;
|
||||
}
|
||||
// check if value is not a primitive type.
|
||||
if (Object.values(values).filter(value => Object(value) === value).length) {
|
||||
// eslint-disable-next-line react/jsx-filename-extension
|
||||
return <formatMessageFunction {...{ message: msg, values }} />;
|
||||
}
|
||||
Object.keys(values).forEach((key) => {
|
||||
// eslint-disable-next-line
|
||||
message = message.replace(`{${key}}`, values[key]);
|
||||
@@ -188,4 +193,8 @@ export class MockUseState {
|
||||
expect(this.hooks.state[key](testValue)).toEqual(useState(testValue));
|
||||
});
|
||||
}
|
||||
|
||||
get values() {
|
||||
return StrictDict({ ...this.hooks.state });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user