component-dbs-core
Version:
DTO objects shared among device backend
54 lines • 2.51 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.VerifyPinTestSuite = void 0;
/* istanbul ignore file */
/* eslint-disable */
const testCases_1 = require("./testCases");
const uuid_1 = require("uuid");
class VerifyPinTestSuite {
constructor() {
this.params = [
[testCases_1.IdentityTestCase.VERIFY_PIN_SUCCESS, true],
[testCases_1.IdentityTestCase.VERIFY_PIN_FAIL, false],
];
}
getParameterForTestCase(testCase, deviceService) {
return __awaiter(this, void 0, void 0, function* () {
const validPin = "1023";
const model = uuid_1.v4().slice(-16);
const serial = uuid_1.v4().slice(-16);
const deviceUuid = yield deviceService.getDeviceUuid({ model, serial });
const validAccessToken = "accessToken";
yield deviceService.saveDeviceTokens(deviceUuid.id, validAccessToken, "refreshToken");
yield deviceService.saveDevicePin(deviceUuid.id, validPin);
switch (testCase) {
case testCases_1.IdentityTestCase.VERIFY_PIN_FAIL:
return {
pin: "",
deviceUuid: deviceUuid.id,
testCaseCode: testCase,
accessToken: validAccessToken,
};
case testCases_1.IdentityTestCase.VERIFY_PIN_SUCCESS:
default:
return {
pin: validPin,
deviceUuid: deviceUuid.id,
accessToken: validAccessToken,
testCaseCode: testCase,
};
}
});
}
}
exports.VerifyPinTestSuite = VerifyPinTestSuite;
//# sourceMappingURL=verifyPinTestSuite.js.map