@pixwel/pixwel-sdk 2.1.25 → 2.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/src/Order.js CHANGED
@@ -56,10 +56,13 @@ var Order = function () {
56
56
  if (!this.dng) {
57
57
  return null;
58
58
  }
59
- if (this.dng.graphics && this.dng.graphics.includes('Dedicated / Localized')) {
60
- return false;
59
+ if (this.dng.dialogue.includes("Dedicated / Localized")) {
60
+ return true;
61
61
  }
62
- return _lodash2.default.flattenDeep((0, _entries2.default)(this.dng)).includes("Dedicated / Localized");
62
+ if (this.dng.narration.includes("Dedicated / Localized")) {
63
+ return true;
64
+ }
65
+ return false;
63
66
  }
64
67
  /**
65
68
  * Determines in an order should be classified as 'subbed' based on its dng values
@@ -71,7 +74,7 @@ var Order = function () {
71
74
  if (!this.dng) {
72
75
  return null;
73
76
  }
74
- if (this.dng === 'Graphics Only') return false;
77
+ if (this.dng === "Graphics Only") return false;
75
78
  return _lodash2.default.flattenDeep((0, _entries2.default)(this.dng)).includes("Subtitled");
76
79
  }
77
80
  }]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixwel/pixwel-sdk",
3
3
  "description": "",
4
- "version": "2.1.25",
4
+ "version": "2.1.26",
5
5
  "author": "Pixwel",
6
6
  "license": "UNLICENSED",
7
7
  "main": "./dist/index.js",
package/src/Order.js CHANGED
@@ -21,12 +21,13 @@ export default class Order {
21
21
  if (!this.dng) {
22
22
  return null;
23
23
  }
24
- if (this.dng.graphics && this.dng.graphics.includes('Dedicated / Localized')) {
25
- return false;
24
+ if (this.dng.dialogue.includes("Dedicated / Localized")) {
25
+ return true;
26
26
  }
27
- return _
28
- .flattenDeep(Object.entries(this.dng))
29
- .includes("Dedicated / Localized");
27
+ if (this.dng.narration.includes("Dedicated / Localized")) {
28
+ return true;
29
+ }
30
+ return false;
30
31
  }
31
32
  /**
32
33
  * Determines in an order should be classified as 'subbed' based on its dng values
@@ -35,9 +36,7 @@ export default class Order {
35
36
  if (!this.dng) {
36
37
  return null;
37
38
  }
38
- if (this.dng === 'Graphics Only') return false;
39
- return _
40
- .flattenDeep(Object.entries(this.dng))
41
- .includes("Subtitled");
39
+ if (this.dng === "Graphics Only") return false;
40
+ return _.flattenDeep(Object.entries(this.dng)).includes("Subtitled");
42
41
  }
43
42
  }
@@ -0,0 +1,44 @@
1
+ import Order from "../src/Order";
2
+
3
+ describe("Order", () => {
4
+ describe("isDub", () => {
5
+ it("should set DUB if Dialogue, Narration, or both are selected", () => {
6
+ let order = new Order({
7
+ dng: {
8
+ dialogue: ["Dedicated / Localized"],
9
+ narration: ["Dedicated / Localized"],
10
+ graphics: ["Dedicated / Localized"]
11
+ }
12
+ });
13
+ expect(order.isDub()).toBe(true);
14
+ });
15
+ it("should NOT set DUB if only Graphics is selected", () => {
16
+ let order = new Order({
17
+ dng: {
18
+ dialogue: [],
19
+ narration: [],
20
+ graphics: ["Dedicated / Localized"]
21
+ }
22
+ });
23
+ expect(order.isDub()).toBe(false);
24
+ });
25
+ });
26
+ describe("isSub", () => {
27
+ it("should set SUB if any DNG contains Subtitled", () => {
28
+ let order = new Order({
29
+ dng: {
30
+ dialogue: ["Subtitled"],
31
+ narration: [],
32
+ graphics: []
33
+ }
34
+ });
35
+ expect(order.isSub()).toBe(true);
36
+ });
37
+ it("should not set SUB if DNG is Graphics Only", () => {
38
+ let order = new Order({
39
+ dng: "Grapghics Only"
40
+ });
41
+ expect(order.isSub()).toBe(false);
42
+ });
43
+ });
44
+ });