1
0
mirror of https://github.com/SomboChea/ui synced 2026-01-19 01:25:51 +07:00

chore: relocate unit test (#39)

add new json snapshot serializer
This commit is contained in:
Juan Picado @jotadeveloper
2019-05-01 21:02:46 +02:00
committed by Ayush Sharma
parent 1070e5c3aa
commit 9d7be476ad
35 changed files with 38 additions and 34 deletions

View File

@@ -0,0 +1,21 @@
import {API_ERROR} from '../../../../src/lib/constants';
/**
* API mock for login endpoint
* @param {object} config configuration of api call
* @returns {promise}
*/
export default function(config) {
return new Promise((resolve, reject) => {
const body = JSON.parse(config.body);
if (body.username === 'sam' && body.password === '1234') {
resolve({
username: 'sam',
token: 'TEST_TOKEN'
});
} else {
reject({
error: API_ERROR.BAD_USERNAME_PASSWORD
});
}
});
}