component-dbs-core
Version:
DTO objects shared among device backend
66 lines • 3.17 kB
JavaScript
;
/* istanbul ignore file */
/* eslint-disable */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoginTestSuite = void 0;
const uuid_1 = require("uuid");
const identityDto_1 = require("../../dtos/identityDto");
const testCases_1 = require("./testCases");
class LoginTestSuite {
constructor() {
this.params = [
[
testCases_1.IdentityTestCase.LOGIN_SUCCESS,
new identityDto_1.IdentityDto(true, 'accessToken', 'refreshToken', 'idToken'),
],
[
testCases_1.IdentityTestCase.LOGIN_FAIL_INCORRECT_CREDS,
{ message: 'ERROR_INCORRECT_EMAIL_OR_PASSWORD' },
],
];
}
getParameterForTestCase(testCase, deviceService, testWithMockAPi) {
return __awaiter(this, void 0, void 0, function* () {
switch (testCase) {
case testCases_1.IdentityTestCase.LOGIN_SUCCESS: {
const model = uuid_1.v4().slice(-16);
const serial = uuid_1.v4().slice(-16);
const deviceUuid = yield deviceService.getDeviceUuid({ model, serial });
if (testWithMockAPi) {
return {
email: 'loginSuccess@gmail.com',
password: 'kisparol',
deviceUuid: deviceUuid.id,
grantType: 'password',
testCaseCode: testCase,
};
}
return new identityDto_1.IdentityLoginInputDto('rolandvagyok@gmail.com', 'kisParol123!', deviceUuid.id);
}
case testCases_1.IdentityTestCase.LOGIN_FAIL_INCORRECT_CREDS: {
if (testWithMockAPi) {
return {
email: 'loginFail@gmail.com',
password: 'kisParol123!',
deviceUuid: '6ff1fbac-cd51-4149-a61d-f2d5ce701456',
grantType: 'password',
testCaseCode: testCase,
};
}
return new identityDto_1.IdentityLoginInputDto('rolandvagyok@gmail.com', 'kisparol', '6ff1fbac-cd51-4149-a61d-f2d5ce701456');
}
}
});
}
}
exports.LoginTestSuite = LoginTestSuite;
//# sourceMappingURL=loginTestSuite.js.map