component-dbs-core
Version:
DTO objects shared among device backend
65 lines • 3.08 kB
JavaScript
;
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.SignUpTestSuite = void 0;
/* istanbul ignore file */
/* eslint-disable */
const uuid_1 = require("uuid");
const identityDto_1 = require("../../dtos/identityDto");
const testCases_1 = require("./testCases");
class SignUpTestSuite {
constructor() {
this.params = [
[
testCases_1.IdentityTestCase.SIGNUP_SUCCESS,
new identityDto_1.IdentityDto(true, 'accessToken', 'refreshToken', 'idToken'),
],
[
testCases_1.IdentityTestCase.SIGNUP_FAIL_USER_EXISTS,
{ message: 'ERROR_USER_EXIST' },
],
];
}
getParameterForTestCase(testCase, deviceService, testWithMockApi) {
return __awaiter(this, void 0, void 0, function* () {
switch (testCase) {
case testCases_1.IdentityTestCase.SIGNUP_SUCCESS: {
const emailSuffix = new Date().getTime();
const model = uuid_1.v4().slice(-16);
const serial = uuid_1.v4().slice(-16);
const deviceUuid = yield deviceService.getDeviceUuid({ model, serial });
const param = {
email: `roland-${emailSuffix}@gmail.com`,
password: 'kisParol123!',
deviceUuid: deviceUuid.id,
testCaseCode: testCase,
};
if (testWithMockApi)
return param;
return new identityDto_1.IdentityLoginInputDto(param.email, param.password, param.deviceUuid);
}
case testCases_1.IdentityTestCase.SIGNUP_FAIL_USER_EXISTS: {
const param = {
email: 'mail-exists@gmail.com',
password: 'kisParol123!',
deviceUuid: '6ff1fbac-cd51-4149-a61d-f2d5ce701456',
testCaseCode: testCase,
};
if (testWithMockApi)
return param;
return new identityDto_1.IdentityLoginInputDto(param.email, param.password, param.deviceUuid);
}
}
});
}
}
exports.SignUpTestSuite = SignUpTestSuite;
//# sourceMappingURL=signUpTestSuite.js.map