GithubHelp home page GithubHelp logo

Test suite about archieml-js HOT 3 OPEN

newsdev avatar newsdev commented on July 20, 2024
Test suite

from archieml-js.

Comments (3)

gka avatar gka commented on July 20, 2024

Example: https://github.com/newsdev/archieml-js/blob/inline-comments/test/parse-documents-test.js

This vows test checks for *.aml files in /test/test-documents/, parses them and compares the output to the corresponding json file.

https://github.com/newsdev/archieml-js/tree/inline-comments/test/test-documents

from archieml-js.

gka avatar gka commented on July 20, 2024

sorry for mixing this into the inline-comments branch, btw

from archieml-js.

abstrctn avatar abstrctn commented on July 20, 2024

Hi @gka - I'm realizing now that the README was missing a step for the existing test suite: there are a series of shared tests available to all parsers in the newsdev/archieml.org repository, but since they're included as a submodule, you have to run git submodule update --init in order to download them, and then nodeunit to run them:

$ git submodule update --init
Submodule 'test/archieml.org' (https://github.com/newsdev/archieml.org) registered for path 'test/archieml.org'
Cloning into 'test/archieml.org'...
remote: Counting objects: 480, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 480 (delta 0), reused 0 (delta 0), pack-reused 477
Receiving objects: 100% (480/480), 331.45 KiB | 0 bytes/s, done.
Resolving deltas: 100% (171/171), done.
Checking connectivity... done.
Submodule path 'test/archieml.org': checked out 'b2e516d590097f18c693d775edcbc1ebbef6111b'

$ nodeunit

loader
✔ loaderTests

shared
✔ sharedTests

OK: 170 assertions (95ms)

That shared test model obviously has some disadvantages though, since it requires A) git submodules, and B) the way that the source AML and expected JSON output are included in the same file is unfamiliar to everyone but me at 2 a.m.:

Example test
test: [array] creates an empty array at array
result: {"array": []}

[array]

The shared.js test runner strips out the first two lines, then checks that the rest of the document gets parsed as {"array": []}: https://github.com/newsdev/archieml-js/blob/inline-comments/test/shared.js#L49-L56


I kind of liked how that kept the source and expected output within the same file (just for ease of editing), but maybe it's worth splitting them into separate files like you had if that's a more familiar pattern to others?

We can also get rid of the submodule and check the tests directly into the app so it's more straightforward to run + edit, but if so we should find another way to keep the tests in sync?

from archieml-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.