update username

This commit is contained in:
realaravinth
2021-08-13 18:58:04 +05:30
parent 595e79a014
commit 6ef941f73d
13 changed files with 238 additions and 171 deletions

View File

@@ -14,7 +14,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import fetchMock from 'jest-fetch-mock';
import userExists from './userExists';
@@ -39,6 +38,10 @@ it('finds exchange', async () => {
usernameField.value = 'test';
expect(await userExists()).toBe(true);
usernameField.value = 'test';
fetchMock.mockResponseOnce(JSON.stringify({exists: true}));
expect(await userExists(usernameField)).toBe(true);
fetchMock.mockResponseOnce(JSON.stringify({exists: false}));
expect(await userExists()).toBe(false);
});