{
  "$schema": "../cases.schema.json",
  "format": 1,
  "domain": "cst",
  "title": {
    "en": "CST",
    "pt-BR": "CST"
  },
  "functions": [
    {
      "id": "cst.isValid",
      "level": "extended",
      "summary": "Checks whether a CST code is valid for a given tax.",
      "description": "Checks whether a CST code is valid for a tax.\n\n- `options.tax` picks the table: `icms`, `ipi`, `pis` or `cofins` (PIS and COFINS share a table). When `options.tax` is omitted or unknown, the function accepts a code that exists in any of the tables.\n- For `icms` the code is one of the 15 Tabela B codes of 2 digits (`00`, `02`, `10`, `15`, `20`, `30`, `40`, `41`, `50`, `51`, `53`, `60`, `61`, `70`, `90`), bare as the NF-e `CST` field carries it next to `orig`, or the 3-digit form with an origin digit `0`-`8` before it. `02`, `15`, `53` and `61` are the monofasia de combustíveis codes that Ajuste SINIEF 39/23 added; `12`, `13`, `52`, `72` and `74` are not codes, because Ajuste SINIEF 20/24 struck them before they took effect.\n- `ipi` accepts 14 codes of 2 digits: `00`-`05`, `49`, `50`-`55` and `99`. `pis` and `cofins` accept 33 codes of 2 digits: `01`-`09`, `49`, `50`-`56`, `60`-`67`, `70`-`75`, `98` and `99`. These taxes have no 3-digit form.\n- Accepts a string or a safe non-negative integer. The 3-digit ICMS form accepts any run of separators (space, `.`, `-` or `/`) right after the origin digit (`\"1--10\"`, `\"0 . 10\"`). A separator anywhere else is rejected (`\"0-0\"`, `\"00-\"`, `\"11-0\"`). Surrounding whitespace is ignored. Any other string (`\"abc110\"`) is rejected, its digits are not picked out.\n- A single digit is padded to the 3-digit ICMS form (`0` and `\"0\"` are `000`, also for the other taxes, so a single digit is never an IPI, PIS or COFINS code). A 2-digit value is a Tabela B code, read as written and never as origin plus a digit: `isValidCst(\"10\", { tax: \"icms\" })` is the Tabela B code 10, and `\"07\"` is not an ICMS code. The number `7` is read as `007`, not as `07`.\n- A `null` or non-object `options` is read as no options, so every table is checked (until 2.4.0 it made the result false).\n- Until 2.4.0 a 2-digit value was never a valid ICMS code (`\"10\"`, `\"00\"` with `tax: \"icms\"` were false) and only one separator was accepted after the origin digit (`\"1--10\"` was false). Both changed in 2.5.0.\n- Sources: the ICMS Tabela B of Convênio SINIEF s/nº 1970 as Ajuste SINIEF 39/23 gave it and Ajuste SINIEF 20/24 amended; IPI, PIS and COFINS from Instrução Normativa RFB nº 1.009/2010.",
      "params": [
        {
          "name": "value",
          "type": "string | number"
        },
        {
          "name": "options",
          "type": "IsValidCstOptions",
          "optional": true
        }
      ],
      "returns": "boolean",
      "cases": [
        {
          "id": "cst.isValid#icms",
          "args": [
            "110"
          ],
          "expect": {
            "returns": true
          }
        },
        {
          "id": "cst.isValid#ipi-only",
          "args": [
            "00"
          ],
          "expect": {
            "returns": true
          }
        },
        {
          "id": "cst.isValid#pis-cofins-only",
          "args": [
            "07"
          ],
          "expect": {
            "returns": true
          }
        },
        {
          "id": "cst.isValid#nonexistent",
          "args": [
            "999"
          ],
          "expect": {
            "returns": false
          }
        },
        {
          "id": "cst.isValid#separator",
          "args": [
            "0-0"
          ],
          "expect": {
            "returns": false
          }
        },
        {
          "id": "cst.isValid#[\"110\",{\"tax\":\"icms\"}]",
          "args": [
            "110",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: icms should return true for a valid origin + CST combination"
        },
        {
          "id": "cst.isValid#[\"000\",{\"tax\":\"icms\"}]",
          "args": [
            "000",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: icms should return true for a valid origin + CST combination"
        },
        {
          "id": "cst.isValid#[\"890\",{\"tax\":\"icms\"}]",
          "args": [
            "890",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: icms should return true for a valid origin + CST combination"
        },
        {
          "id": "cst.isValid#[110,{\"tax\":\"icms\"}]",
          "args": [
            110,
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: icms should return true for a number input"
        },
        {
          "id": "cst.isValid#[\"910\",{\"tax\":\"icms\"}]",
          "args": [
            "910",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: icms should return false when the origin digit is greater than 8"
        },
        {
          "id": "cst.isValid#[\"199\",{\"tax\":\"icms\"}]",
          "args": [
            "199",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: icms should return false when the CST part is not a known code"
        },
        {
          "id": "cst.isValid#[\"002\",{\"tax\":\"icms\"}]",
          "args": [
            "002",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: icms should return true for the monofasia de combustíveis codes Ajuste SINIEF 39/23 added"
        },
        {
          "id": "cst.isValid#[\"015\",{\"tax\":\"icms\"}]",
          "args": [
            "015",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: icms should return true for the monofasia de combustíveis codes Ajuste SINIEF 39/23 added"
        },
        {
          "id": "cst.isValid#[\"053\",{\"tax\":\"icms\"}]",
          "args": [
            "053",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: icms should return true for the monofasia de combustíveis codes Ajuste SINIEF 39/23 added"
        },
        {
          "id": "cst.isValid#[\"061\",{\"tax\":\"icms\"}]",
          "args": [
            "061",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: icms should return true for the monofasia de combustíveis codes Ajuste SINIEF 39/23 added"
        },
        {
          "id": "cst.isValid#[\"012\",{\"tax\":\"icms\"}]",
          "args": [
            "012",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: icms should return false for the codes Ajuste SINIEF 39/23 added with deferred effect and Ajuste SINIEF 20/24 struck before they took effect (12, 13, 52, 72 and 74)"
        },
        {
          "id": "cst.isValid#[\"013\",{\"tax\":\"icms\"}]",
          "args": [
            "013",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: icms should return false for the codes Ajuste SINIEF 39/23 added with deferred effect and Ajuste SINIEF 20/24 struck before they took effect (12, 13, 52, 72 and 74)"
        },
        {
          "id": "cst.isValid#[\"052\",{\"tax\":\"icms\"}]",
          "args": [
            "052",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: icms should return false for the codes Ajuste SINIEF 39/23 added with deferred effect and Ajuste SINIEF 20/24 struck before they took effect (12, 13, 52, 72 and 74)"
        },
        {
          "id": "cst.isValid#[\"072\",{\"tax\":\"icms\"}]",
          "args": [
            "072",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: icms should return false for the codes Ajuste SINIEF 39/23 added with deferred effect and Ajuste SINIEF 20/24 struck before they took effect (12, 13, 52, 72 and 74)"
        },
        {
          "id": "cst.isValid#[\"074\",{\"tax\":\"icms\"}]",
          "args": [
            "074",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: icms should return false for the codes Ajuste SINIEF 39/23 added with deferred effect and Ajuste SINIEF 20/24 struck before they took effect (12, 13, 52, 72 and 74)"
        },
        {
          "id": "cst.isValid#[\"10\",{\"tax\":\"icms\"}]",
          "args": [
            "10",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "changed in 2.5.0 (#615): a bare 2-digit Tabela B code is valid for icms (2.4.0: false). JavaScript's own test: icms should return false for a length different from 3 (now: true for the bare Tabela B codes)"
        },
        {
          "id": "cst.isValid#[\"1020\",{\"tax\":\"icms\"}]",
          "args": [
            "1020",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a length other than 2 or 3"
        },
        {
          "id": "cst.isValid#[\"00\",{\"tax\":\"ipi\"}]",
          "args": [
            "00",
            {
              "tax": "ipi"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: ipi should return true for known codes"
        },
        {
          "id": "cst.isValid#[\"49\",{\"tax\":\"ipi\"}]",
          "args": [
            "49",
            {
              "tax": "ipi"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: ipi should return true for known codes"
        },
        {
          "id": "cst.isValid#[\"99\",{\"tax\":\"ipi\"}]",
          "args": [
            "99",
            {
              "tax": "ipi"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: ipi should return true for known codes"
        },
        {
          "id": "cst.isValid#[\"06\",{\"tax\":\"ipi\"}]",
          "args": [
            "06",
            {
              "tax": "ipi"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: ipi should return false for an unknown code"
        },
        {
          "id": "cst.isValid#[\"07\",{\"tax\":\"pis\"}]",
          "args": [
            "07",
            {
              "tax": "pis"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: pis should return true for known codes"
        },
        {
          "id": "cst.isValid#[\"98\",{\"tax\":\"pis\"}]",
          "args": [
            "98",
            {
              "tax": "pis"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: pis should return true for known codes"
        },
        {
          "id": "cst.isValid#[\"11\",{\"tax\":\"pis\"}]",
          "args": [
            "11",
            {
              "tax": "pis"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: pis should return false for an unknown code"
        },
        {
          "id": "cst.isValid#[\"07\",{\"tax\":\"cofins\"}]",
          "args": [
            "07",
            {
              "tax": "cofins"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: cofins should return true for known codes (same table as pis)"
        },
        {
          "id": "cst.isValid#[\"11\",{\"tax\":\"cofins\"}]",
          "args": [
            "11",
            {
              "tax": "cofins"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cofins should return false for an unknown code"
        },
        {
          "id": "cst.isValid#[\"00\",{\"tax\":\"icms\"}]",
          "args": [
            "00",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "changed in 2.5.0 (#615): a bare 2-digit Tabela B code is valid for icms (2.4.0: false). JavaScript's own test: should consult only the given table, never the other three"
        },
        {
          "id": "cst.isValid#[\"00\",{\"tax\":\"pis\"}]",
          "args": [
            "00",
            {
              "tax": "pis"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should consult only the given table, never the other three"
        },
        {
          "id": "cst.isValid#[\"00\",{\"tax\":\"cofins\"}]",
          "args": [
            "00",
            {
              "tax": "cofins"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should consult only the given table, never the other three"
        },
        {
          "id": "cst.isValid#[\"06\"]",
          "args": [
            "06"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should consult only the given table, never the other three"
        },
        {
          "id": "cst.isValid#[\"49\"]",
          "args": [
            "49"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: without options (tax omitted) should return true when the code exists in both the ipi and pis/cofins tables"
        },
        {
          "id": "cst.isValid#[\"110\",{}]",
          "args": [
            "110",
            {}
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: without options (tax omitted) should return true when options.tax is undefined"
        },
        {
          "id": "cst.isValid#[0,{\"tax\":\"icms\"}]",
          "args": [
            0,
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: padding should read a single digit as the three digit icms form, as a number or as a string"
        },
        {
          "id": "cst.isValid#[\"0\",{\"tax\":\"icms\"}]",
          "args": [
            "0",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: padding should read a single digit as the three digit icms form, as a number or as a string"
        },
        {
          "id": "cst.isValid#[2,{\"tax\":\"icms\"}]",
          "args": [
            2,
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: padding should read a single digit as the three digit icms form, as a number or as a string"
        },
        {
          "id": "cst.isValid#[\"2\",{\"tax\":\"icms\"}]",
          "args": [
            "2",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: padding should read a single digit as the three digit icms form, as a number or as a string"
        },
        {
          "id": "cst.isValid#[0]",
          "args": [
            0
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: padding should agree between a number and a string when the tax is omitted"
        },
        {
          "id": "cst.isValid#[\"0\"]",
          "args": [
            "0"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: padding should agree between a number and a string when the tax is omitted"
        },
        {
          "id": "cst.isValid#[9]",
          "args": [
            9
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: padding should agree between a number and a string when the tax is omitted"
        },
        {
          "id": "cst.isValid#[\"9\"]",
          "args": [
            "9"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: padding should agree between a number and a string when the tax is omitted"
        },
        {
          "id": "cst.isValid#[49,{\"tax\":\"ipi\"}]",
          "args": [
            49,
            {
              "tax": "ipi"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: padding should leave a two digit Tabela B code as written, never padding it to three"
        },
        {
          "id": "cst.isValid#[49,{\"tax\":\"icms\"}]",
          "args": [
            49,
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: padding should leave a two digit Tabela B code as written, never padding it to three"
        },
        {
          "id": "cst.isValid#[\"  0  \",{\"tax\":\"icms\"}]",
          "args": [
            "  0  ",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: padding should trim a single digit before padding it"
        },
        {
          "id": "cst.isValid#[\"  0  \"]",
          "args": [
            "  0  "
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: padding should trim a single digit before padding it"
        },
        {
          "id": "cst.isValid#[\"\",{\"tax\":\"icms\"}]",
          "args": [
            "",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for an empty string"
        },
        {
          "id": "cst.isValid#[\" 1-10 \",{\"tax\":\"icms\"}]",
          "args": [
            " 1-10 ",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should accept a single separator after the origin digit and surrounding whitespace"
        },
        {
          "id": "cst.isValid#[\"0 10\",{\"tax\":\"icms\"}]",
          "args": [
            "0 10",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should accept a single separator after the origin digit and surrounding whitespace"
        },
        {
          "id": "cst.isValid#[\"0.10\",{\"tax\":\"icms\"}]",
          "args": [
            "0.10",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should accept a single separator after the origin digit and surrounding whitespace"
        },
        {
          "id": "cst.isValid#[\"0/10\",{\"tax\":\"icms\"}]",
          "args": [
            "0/10",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should accept a single separator after the origin digit and surrounding whitespace"
        },
        {
          "id": "cst.isValid#[\"1--10\",{\"tax\":\"icms\"}]",
          "args": [
            "1--10",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "changed in 2.5.0 (#615): a run of separators after the origin digit is accepted (2.4.0: false). JavaScript's own test: should accept a run of separators after the origin digit, as isValidCpf does"
        },
        {
          "id": "cst.isValid#[\"00-\",{\"tax\":\"icms\"}]",
          "args": [
            "00-",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a separator does not sit right after the origin digit"
        },
        {
          "id": "cst.isValid#[\"0-0\",{\"tax\":\"icms\"}]",
          "args": [
            "0-0",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a separator does not sit right after the origin digit"
        },
        {
          "id": "cst.isValid#[\"11-0\",{\"tax\":\"icms\"}]",
          "args": [
            "11-0",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a separator does not sit right after the origin digit"
        },
        {
          "id": "cst.isValid#[\"0.0\",{\"tax\":\"icms\"}]",
          "args": [
            "0.0",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a separator does not sit right after the origin digit"
        },
        {
          "id": "cst.isValid#[\"4-9\",{\"tax\":\"ipi\"}]",
          "args": [
            "4-9",
            {
              "tax": "ipi"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a separator does not sit right after the origin digit"
        },
        {
          "id": "cst.isValid#[\"00-\"]",
          "args": [
            "00-"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a separator does not sit right after the origin digit"
        },
        {
          "id": "cst.isValid#[\"11-0\"]",
          "args": [
            "11-0"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a separator does not sit right after the origin digit"
        },
        {
          "id": "cst.isValid#[\"0.0\"]",
          "args": [
            "0.0"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a separator does not sit right after the origin digit"
        },
        {
          "id": "cst.isValid#[\"4-9\"]",
          "args": [
            "4-9"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a separator does not sit right after the origin digit"
        },
        {
          "id": "cst.isValid#[\"abc110\",{\"tax\":\"icms\"}]",
          "args": [
            "abc110",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a string that is not a documented form"
        },
        {
          "id": "cst.isValid#[-110,{\"tax\":\"icms\"}]",
          "args": [
            -110,
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a number that is not a non-negative safe integer"
        },
        {
          "id": "cst.isValid#[1.1,{\"tax\":\"icms\"}]",
          "args": [
            1.1,
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a number that is not a non-negative safe integer"
        },
        {
          "id": "cst.isValid#[\"02\",{\"tax\":\"icms\"}]",
          "args": [
            "02",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"15\",{\"tax\":\"icms\"}]",
          "args": [
            "15",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"20\",{\"tax\":\"icms\"}]",
          "args": [
            "20",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"30\",{\"tax\":\"icms\"}]",
          "args": [
            "30",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"40\",{\"tax\":\"icms\"}]",
          "args": [
            "40",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"41\",{\"tax\":\"icms\"}]",
          "args": [
            "41",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"50\",{\"tax\":\"icms\"}]",
          "args": [
            "50",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"51\",{\"tax\":\"icms\"}]",
          "args": [
            "51",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"53\",{\"tax\":\"icms\"}]",
          "args": [
            "53",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"60\",{\"tax\":\"icms\"}]",
          "args": [
            "60",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin. Also a JavaScript docs example"
        },
        {
          "id": "cst.isValid#[\"61\",{\"tax\":\"icms\"}]",
          "args": [
            "61",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"70\",{\"tax\":\"icms\"}]",
          "args": [
            "70",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"90\",{\"tax\":\"icms\"}]",
          "args": [
            "90",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the bare 2 digit Tabela B codes, the NF-e CST field next to the origin"
        },
        {
          "id": "cst.isValid#[\"01\",{\"tax\":\"icms\"}]",
          "args": [
            "01",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a 2 digit value that is not a Tabela B code"
        },
        {
          "id": "cst.isValid#[\"07\",{\"tax\":\"icms\"}]",
          "args": [
            "07",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a 2 digit value that is not a Tabela B code"
        },
        {
          "id": "cst.isValid#[\"12\",{\"tax\":\"icms\"}]",
          "args": [
            "12",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a 2 digit value that is not a Tabela B code"
        },
        {
          "id": "cst.isValid#[\"49\",{\"tax\":\"icms\"}]",
          "args": [
            "49",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a 2 digit value that is not a Tabela B code"
        },
        {
          "id": "cst.isValid#[\"99\",{\"tax\":\"icms\"}]",
          "args": [
            "99",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a 2 digit value that is not a Tabela B code"
        },
        {
          "id": "cst.isValid#[\"10200\",{\"tax\":\"icms\"}]",
          "args": [
            "10200",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for a length other than 2 or 3"
        },
        {
          "id": "cst.isValid#[\"10\"]",
          "args": [
            "10"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: without options should return true when the code exists only in the icms Tabela B"
        },
        {
          "id": "cst.isValid#[\"15\"]",
          "args": [
            "15"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: without options should return true when the code exists only in the icms Tabela B"
        },
        {
          "id": "cst.isValid#[\"41\"]",
          "args": [
            "41"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: without options should return true when the code exists only in the icms Tabela B"
        },
        {
          "id": "cst.isValid#[\"90\"]",
          "args": [
            "90"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: without options should return true when the code exists only in the icms Tabela B"
        },
        {
          "id": "cst.isValid#[\"999\"]",
          "args": [
            "999"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: without options should return false when the code exists in no table"
        },
        {
          "id": "cst.isValid#[\"00\",null]",
          "args": [
            "00",
            null
          ],
          "expect": {
            "returns": true
          },
          "note": "changed in 2.5.0 (#615): a null options is read as none (2.4.0: false). JavaScript's own test: should read null options as none, checking every table"
        },
        {
          "id": "cst.isValid#[\"999\",null]",
          "args": [
            "999",
            null
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should read null options as none, checking every table"
        },
        {
          "id": "cst.isValid#[\"06\",\"foo\"]",
          "args": [
            "06",
            "foo"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should read a non-object options value as none, checking every table"
        },
        {
          "id": "cst.isValid#[\"06\",1]",
          "args": [
            "06",
            1
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should read a non-object options value as none, checking every table"
        },
        {
          "id": "cst.isValid#[\"07\",{\"tax\":\"iss\"}]",
          "args": [
            "07",
            {
              "tax": "iss"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: an unknown tax falls back to checking every table"
        },
        {
          "id": "cst.isValid#[\"999\",{\"tax\":\"iss\"}]",
          "args": [
            "999",
            {
              "tax": "iss"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should still reject a code that exists in no table"
        },
        {
          "id": "cst.isValid#[\"000\",{\"tax\":\"nope\"}]",
          "args": [
            "000",
            {
              "tax": "nope"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript docs example: an unknown tax falls back to every table"
        },
        {
          "id": "cst.isValid#[\"0 . 10\",{\"tax\":\"icms\"}]",
          "args": [
            "0 . 10",
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should accept a run of separators after the origin digit, as isValidCpf does"
        },
        {
          "id": "cst.isValid#[60,{\"tax\":\"icms\"}]",
          "args": [
            60,
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should leave a two digit Tabela B code as written, never padding it to three"
        },
        {
          "id": "cst.isValid#[90,{\"tax\":\"icms\"}]",
          "args": [
            90,
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should leave a two digit Tabela B code as written, never padding it to three"
        },
        {
          "id": "cst.isValid#[7,{\"tax\":\"icms\"}]",
          "args": [
            7,
            {
              "tax": "icms"
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should leave a two digit Tabela B code as written, never padding it to three (7 is the ICMS code 007)"
        }
      ]
    }
  ]
}
