diff --git a/db/tests/vn/item_getBalance.spec.js b/db/tests/vn/item_getBalance.spec.js new file mode 100644 index 000000000..2e24d5ce7 --- /dev/null +++ b/db/tests/vn/item_getBalance.spec.js @@ -0,0 +1,31 @@ +const app = require('vn-loopback/server/server'); +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; + +describe('item_getBalance()', () => { + it(`should return the item balance ordered by alert level`, async() => { + let stmts = []; + + let params = { + warehouseFk: 1, + itemFk: 1 + }; + + const conn = await app.models.Item.dataSource.connector; + + stmts.push(new ParameterizedSQL('CALL vn.item_getBalance(?, ?)', [ + params.warehouseFk, + params.itemFk + ])); + + let sql = ParameterizedSQL.join(stmts, ';'); + let result = await conn.executeStmt(sql); + let itemBalance = result[0]; + + expect(itemBalance[0].alertLevel).toBeGreaterThanOrEqual(itemBalance[1].alertLevel); + expect(itemBalance[1].alertLevel).toBeGreaterThanOrEqual(itemBalance[2].alertLevel); + expect(itemBalance[2].alertLevel).toBeGreaterThanOrEqual(itemBalance[3].alertLevel); + expect(itemBalance[3].alertLevel).toBeGreaterThanOrEqual(itemBalance[4].alertLevel); + expect(itemBalance[4].alertLevel).toBeGreaterThanOrEqual(itemBalance[5].alertLevel); + expect(itemBalance[5].alertLevel).toBeGreaterThanOrEqual(itemBalance[6].alertLevel); + }); +}); diff --git a/package-lock.json b/package-lock.json index 26a17ed67..68004c13c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9575,13 +9575,13 @@ "dev": true }, "jasmine-reporters": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/jasmine-reporters/-/jasmine-reporters-2.3.2.tgz", - "integrity": "sha512-u/7AT9SkuZsUfFBLLzbErohTGNsEUCKaQbsVYnLFW1gEuL2DzmBL4n8v90uZsqIqlWvWUgian8J6yOt5Fyk/+A==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jasmine-reporters/-/jasmine-reporters-2.4.0.tgz", + "integrity": "sha512-jxONSrBLN1vz/8zCx5YNWQSS8iyDAlXQ5yk1LuqITe4C6iXCDx5u6Q0jfNtkKhL4qLZPe69fL+AWvXFt9/x38w==", "dev": true, "requires": { "mkdirp": "^0.5.1", - "xmldom": "^0.1.22" + "xmldom": "^0.5.0" } }, "jasmine-spec-reporter": { @@ -19907,7 +19907,7 @@ }, "globby": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz", "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { @@ -20470,9 +20470,9 @@ "integrity": "sha1-+mv3YqYKQT+z3Y9LA8WyaSONMI8=" }, "xmldom": { - "version": "0.1.31", - "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.31.tgz", - "integrity": "sha512-yS2uJflVQs6n+CyjHoaBmVSqIDevTAWrzMmjG1Gc7h1qQ7uVozNhEPJAwZXWyGQ/Gafo3fCwrcaokezLPupVyQ==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.5.0.tgz", + "integrity": "sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==", "dev": true }, "xpath": { @@ -20568,7 +20568,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { diff --git a/package.json b/package.json index ad1ff9188..ff70e2c4e 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "html-webpack-plugin": "^4.0.0-beta.11", "identity-obj-proxy": "^3.0.0", "jasmine": "^3.6.3", - "jasmine-reporters": "^2.3.2", + "jasmine-reporters": "^2.4.0", "jasmine-spec-reporter": "^6.0.0", "jest": "^26.0.1", "jest-junit": "^8.0.0",