Skip to content

Add basic tests #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lachenmayer
Copy link
Contributor

I added some new tests in #5 and I just wanted to double check that I didn't mess up the test implementation.

This just adds the example script as a basic test.

Some of the existing tests are failing, even with random-access-file:

# read empty
not ok 4 no error
  ---
    operator: error
    expected: |-
      undefined
    actual: |-
      { [Error: ENOENT: no such file or directory, open '/var/folders/z8/xq1r3qcd7szbpx1_77xsgpqc0000gn/T/random-access-file-58676-1531846996824/create-empty.txt'] errno: -2, code: 'ENOENT', syscall: 'open', path: '/var/folders/z8/xq1r3qcd7szbpx1_77xsgpqc0000gn/T/random-access-file-58676-1531846996824/create-empty.txt' }
    at: Request._callback (/Users/harry/Documents/node_modules/random-access-test/index.js:23:11)
    stack: |-
      Error: ENOENT: no such file or directory, open '/var/folders/z8/xq1r3qcd7szbpx1_77xsgpqc0000gn/T/random-access-file-58676-1531846996824/create-empty.txt'
  ...
not ok 5 empty buffer
  ---
    operator: deepEqual
    expected: <Buffer >
    actual:   undefined
    at: Request._callback (/Users/harry/Documents/node_modules/random-access-test/index.js:24:11)
    stack: |-
      Error: empty buffer
          at Test.assert [as _assert] (/Users/harry/Documents/node_modules/random-access-test/node_modules/tape/lib/test.js:224:54)
          at Test.bound [as _assert] (/Users/harry/Documents/node_modules/random-access-test/node_modules/tape/lib/test.js:76:32)
          at Test.tapeDeepEqual (/Users/harry/Documents/node_modules/random-access-test/node_modules/tape/lib/test.js:421:10)
          at Test.bound [as same] (/Users/harry/Documents/node_modules/random-access-test/node_modules/tape/lib/test.js:76:32)
          at Request._callback (/Users/harry/Documents/node_modules/random-access-test/index.js:24:11)
          at Request.callback (/Users/harry/Documents/node_modules/random-access-test/node_modules/random-access-storage/index.js:161:8)
          at nextTickCallback (/Users/harry/Documents/node_modules/random-access-test/node_modules/random-access-storage/index.js:249:7)
          at process._tickCallback (internal/process/next_tick.js:63:19)
  ...
# bad truncate
not ok 24 should be truthy
  ---
    operator: ok
    expected: true
    actual:   null
    at: Request._callback (/Users/harry/Documents/node_modules/random-access-test/index.js:133:15)
    stack: |-
      Error: should be truthy
          at Test.assert [as _assert] (/Users/harry/Documents/node_modules/random-access-test/node_modules/tape/lib/test.js:224:54)
          at Test.bound [as _assert] (/Users/harry/Documents/node_modules/random-access-test/node_modules/tape/lib/test.js:76:32)
          at Test.assert (/Users/harry/Documents/node_modules/random-access-test/node_modules/tape/lib/test.js:342:10)
          at Test.bound [as ok] (/Users/harry/Documents/node_modules/random-access-test/node_modules/tape/lib/test.js:76:32)
          at Request._callback (/Users/harry/Documents/node_modules/random-access-test/index.js:133:15)
          at Request.callback (/Users/harry/Documents/node_modules/random-access-test/node_modules/random-access-storage/index.js:161:8)
          at ontruncate (/Users/harry/Documents/node_modules/random-access-test/node_modules/random-access-file/index.js:163:9)
          at FSReqWrap.oncomplete (fs.js:145:20)
  ...

Not sure what the correct behavior is meant to be.

@kenOfYugen
Copy link

I came across the same issue, while making a new provider.
For example, the read empty test passes with random-access-file, by adding the {writable: true} option as implemented in the internal tests.
So in this case, should the conformance test, or the random-access-file implementation be changed? Basically the question I ask is, can the spec be considered stable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants