@xapp/dynamo-service
Advanced tools
Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.2
@@ -59,2 +59,11 @@ "use strict"; | ||
})); | ||
it("Tests that an item is put even if it doesn't contain optional items.", () => __awaiter(this, void 0, void 0, function* () { | ||
const schema = buildTableSchema({ optionalParam: { type: "S" } }); | ||
const service = new Service.NuTableService(tableName, dynamoService, schema); | ||
yield service.put({ "primaryKey": "TestKey" }); | ||
expect(dynamoService.put).to.have.been.calledWithMatch(tableName, { "primaryKey": "TestKey" }, { | ||
ConditionExpression: "attribute_not_exists(#___cond_NC0)", | ||
ExpressionAttributeNames: { "#___cond_NC0": "primaryKey" } | ||
}); | ||
})); | ||
it("Tests that a schema is converted.", () => __awaiter(this, void 0, void 0, function* () { | ||
@@ -61,0 +70,0 @@ const schema = buildTableSchema({ "stringParam": { type: "S", slugify: true } }); |
@@ -1,1 +0,1 @@ | ||
export * from "./TableService"; | ||
export * from "./NuTableService"; |
@@ -6,2 +6,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./TableService")); | ||
__export(require("./NuTableService")); |
@@ -15,2 +15,6 @@ "use strict"; | ||
}); | ||
it("Tests that undefined is ignored.", () => { | ||
const validator = Validator.isDateObjValidator(); | ||
ValidatorTestUtils_1.expectToHaveNoErrors(validator("TestKey", undefined, undefined)); | ||
}); | ||
}); | ||
@@ -30,3 +34,7 @@ describe(Validator.isDateObjUpdateBodyValidator.name, () => { | ||
}); | ||
it("Tests that no error is thrown if the date is being set to undefined.", () => { | ||
const validator = Validator.isDateObjUpdateBodyValidator(); | ||
ValidatorTestUtils_1.expectToHaveNoErrors(validator("TestKey", undefined, { set: { "TestKey": undefined } })); | ||
}); | ||
}); | ||
}); |
@@ -5,3 +5,3 @@ "use strict"; | ||
return (key, schema, obj) => { | ||
if (isNotDate(obj)) { | ||
if (obj != null && isNotDate(obj)) { | ||
return `Key "${key}" is not a valid date.`; | ||
@@ -8,0 +8,0 @@ } |
@@ -22,2 +22,9 @@ "use strict"; | ||
}); | ||
it("Tests that no error is thrown if the object is undefined.", () => { | ||
const schema = { | ||
type: "S" | ||
}; | ||
const validator = Validator.isCorrectValueTypeValidator("string"); | ||
ValidatorTestUtils_1.expectToHaveNoErrors(validator("TestKey", schema, undefined)); | ||
}); | ||
}); | ||
@@ -24,0 +31,0 @@ describe(Validator.isCorrectValueTypeUpdateBodyValidator.name, () => { |
@@ -82,2 +82,10 @@ "use strict"; | ||
else { | ||
it("Tests that an error is thrown if the user is attempting to set the wrong type.", () => { | ||
const testValue = (valueType === "number") ? "testString" : 4; | ||
checkForErrors(() => schema.validateObjectAgainstSchema({ "Test": testValue }), [`Key "Test" is expected to be of type ${valueType} but got ${typeof testValue}.`]); | ||
}); | ||
it("Tests that an error is not thrown if the user is attempting to set the object and undefined.", () => { | ||
const testValue = undefined; | ||
checkForErrors(() => schema.validateObjectAgainstSchema({ "Test": testValue }), []); | ||
}); | ||
it("Tests that an error is thrown if the user is attempting to change the type.", () => { | ||
@@ -87,2 +95,6 @@ const testValue = (valueType === "number") ? "testString" : 4; | ||
}); | ||
it("Tests that no error is thrown if the object is undefined.", () => { | ||
const testValue = undefined; | ||
checkForErrors(() => schema.validateUpdateObjectAgainstSchema({ set: { "Test": testValue } }), []); | ||
}); | ||
} | ||
@@ -89,0 +101,0 @@ } |
@@ -5,3 +5,3 @@ "use strict"; | ||
return (key, schema, obj) => { | ||
if (typeof obj !== expectedType) { | ||
if (obj != null && typeof obj !== expectedType) { | ||
return `Key "${key}" is expected to be of type ${expectedType} but got ${typeof obj}.`; | ||
@@ -15,3 +15,3 @@ } | ||
const { set } = obj; | ||
if (set && set[key] && typeof set[key] !== expectedType) { | ||
if (set && set[key] != null && typeof set[key] !== expectedType) { | ||
return `Key "${key}" is expected to be of type ${expectedType} but got ${typeof set[key]}.`; | ||
@@ -18,0 +18,0 @@ } |
{ | ||
"name": "@xapp/dynamo-service", | ||
"version": "1.0.0-alpha.1", | ||
"version": "1.0.0-alpha.2", | ||
"description": "A dynamo help class which will help maintain data integrity.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
275833
5049
2