eloquent / precis-js

A JavaScript implementation of RFC 7564 (The PRECIS Framework).
MIT License
6 stars 0 forks source link

Tests do not pass #4

Closed sonnyp closed 8 years ago

sonnyp commented 9 years ago

For some reason (will investigate) tests do not pass here


> precis-js@0.0.0 test precis-js
> bin/test

  ✓ src/PrecisEnforcer.coffee
  ✓ src/PrecisPreparer.coffee
  ✓ src/constants.coffee
  ✓ src/enforce-common.coffee
  ✓ src/enforce-es6.coffee
  ✓ src/enforce.coffee
  ✓ src/error/EmptyStringError.coffee
  ✓ src/error/InvalidCodepointError.coffee
  ✓ src/error/InvalidDirectionalityError.coffee
  ✓ src/prepare.coffee
  ✓ src/profile/NicknameProfile.coffee
  ✓ src/profile/OpaqueStringProfile.coffee
  ✓ src/profile/UsernameCaseMappedProfile.coffee
  ✓ src/profile/UsernameCasePreservedProfile.coffee
  ✓ src/unicode/CodepointPropertyReader.coffee
  ✓ src/unicode/DirectionalityValidator.coffee
  ✓ src/unicode/Normalizer.coffee
  ✓ src/unicode/WidthMapper.coffee

✓ Ok! » 0 errors and 0 warnings in 18 files

  ✓ test/helper/bootstrap.coffee
  ✓ test/suite/PrecisEnforcer.spec.coffee
  ✓ test/suite/PrecisPreparer.spec.coffee
  ✓ test/suite/enforce-es6.spec.coffee
  ✓ test/suite/enforce.spec.coffee
  ✓ test/suite/error/EmptyStringError.spec.coffee
  ✓ test/suite/prepare.spec.coffee
  ✓ test/suite/profile/NicknameProfile.spec.coffee
  ✓ test/suite/profile/OpaqueStringProfile.spec.coffee
  ✓ test/suite/profile/UsernameCaseMappedProfile.spec.coffee
  ✓ test/suite/profile/UsernameCasePreservedProfile.spec.coffee
  ✓ test/suite/unicode/CodepointPropertyReader.spec.coffee
  ✓ test/suite/unicode/DirectionalityValidator.spec.coffee
  ✓ test/suite/unicode/Normalizer.spec.coffee
  ✓ test/suite/unicode/WidthMapper.spec.coffee

✓ Ok! » 0 errors and 0 warnings in 15 files

  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  ․․․․․․

  106 passing (532ms)
  12 failing

  1) PrecisEnforcer enforce() profile normalization options supports NFC normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ 246, 775, 246, 775, 559, 776, 8547 ]
      + expected - actual

       [
         246
         775
      -  111
      -  776
      +  246
         775
      -  111
      -  775
      +  559
         776
         8547
       ]

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/PrecisEnforcer.spec.coffee:138:24)

  2) PrecisEnforcer enforce() profile normalization options supports NFD normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ Array(10) ]
      + expected - actual

       [
      -  246
      +  111
      +  776
         775
         111
         776
         775

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/PrecisEnforcer.spec.coffee:145:24)

  3) PrecisEnforcer enforce() profile normalization options supports NFKC normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ Array(8) ]
      + expected - actual

       [
         246
         775
      -  111
      -  776
      +  246
         775
      -  111
      -  775
      +  559
         776
      -  8547
      +  73
      +  86
       ]

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/PrecisEnforcer.spec.coffee:152:24)

  4) PrecisEnforcer enforce() profile normalization options supports NFKD normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ Array(11) ]
      + expected - actual

       [
      -  246
      +  111
      +  776
         775
         111
         776
         775
         111
         775
         776
      -  8547
      +  73
      +  86
       ]

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/PrecisEnforcer.spec.coffee:159:24)

  5) enforce-es6 enforce() profile normalization options supports NFC normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ 246, 775, 246, 775, 559, 776, 8547 ]
      + expected - actual

       [
         246
         775
      -  111
      -  776
      +  246
         775
      -  111
      -  775
      +  559
         776
         8547
       ]

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/enforce-es6.spec.coffee:150:24)

  6) enforce-es6 enforce() profile normalization options supports NFD normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ Array(10) ]
      + expected - actual

       [
      -  246
      +  111
      +  776
         775
         111
         776
         775

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/enforce-es6.spec.coffee:157:24)

  7) enforce-es6 enforce() profile normalization options supports NFKC normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ Array(8) ]
      + expected - actual

       [
         246
         775
      -  111
      -  776
      +  246
         775
      -  111
      -  775
      +  559
         776
      -  8547
      +  73
      +  86
       ]

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/enforce-es6.spec.coffee:164:24)

  8) enforce-es6 enforce() profile normalization options supports NFKD normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ Array(11) ]
      + expected - actual

       [
      -  246
      +  111
      +  776
         775
         111
         776
         775
         111
         775
         776
      -  8547
      +  73
      +  86
       ]

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/enforce-es6.spec.coffee:171:24)

  9) enforce enforce() profile normalization options supports NFC normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ 246, 775, 246, 775, 559, 776, 8547 ]
      + expected - actual

       [
         246
         775
      -  111
      -  776
      +  246
         775
      -  111
      -  775
      +  559
         776
         8547
       ]

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/enforce.spec.coffee:149:24)

  10) enforce enforce() profile normalization options supports NFD normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ Array(10) ]
      + expected - actual

       [
      -  246
      +  111
      +  776
         775
         111
         776
         775

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/enforce.spec.coffee:156:24)

  11) enforce enforce() profile normalization options supports NFKC normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ Array(8) ]
      + expected - actual

       [
         246
         775
      -  111
      -  776
      +  246
         775
      -  111
      -  775
      +  559
         776
      -  8547
      +  73
      +  86
       ]

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/enforce.spec.coffee:163:24)

  12) enforce enforce() profile normalization options supports NFKD normalization:

      AssertionError: expected [ Array(9) ] to deeply equal [ Array(11) ]
      + expected - actual

       [
      -  246
      +  111
      +  776
         775
         111
         776
         775
         111
         775
         776
      -  8547
      +  73
      +  86
       ]

    at Function.assert.deepEqual (node_modules/chai/lib/chai/interface/assert.js:207:32)
    at Context.<anonymous> (test/suite/enforce.spec.coffee:170:24)
sonnyp commented 9 years ago

Okay this is weird. Tests pass using Node.js 0.12, 4.0, 4.1 from nvm. Tests fails using Node.js 4.1 from homebrew.

ezzatron commented 9 years ago

Hi, sorry for the delayed response, I'm on a holiday right now, so I can't easily investigate. But given that all these errors are to do with normalization, I suspect it's to do with which version of Unicode node has been compiled with.

It could also be a bug in my normalizer. It switches between ES6 normalization and unorm depending on what's available.

sonnyp commented 8 years ago

don't use OS X anymore, tests passes correctly on my Node binary, closing this