mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
e03672b70b
test name fixes
26 lines
551 B
JavaScript
26 lines
551 B
JavaScript
/**
|
|
* API mock for login endpoint
|
|
* @param {object} config configuration of api call
|
|
* @returns {promise}
|
|
*/
|
|
export default function(config) {
|
|
return new Promise(function(resolve, reject) {
|
|
if (config.data.username === 'sam' && config.data.password === '1234') {
|
|
resolve({
|
|
status: 200,
|
|
data: {
|
|
username: 'sam',
|
|
token: 'TEST_TOKEN'
|
|
}
|
|
});
|
|
} else {
|
|
reject({
|
|
response: {
|
|
status: 401,
|
|
data: { error: 'Unauthorized' }
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|