Front end of the Slack clone application.

00-setup-fixtures.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // the fixtures have some weird stuff that is painful
  2. // to include directly in the repo for various reasons.
  3. //
  4. // So, unpack the fixtures with the system tar first.
  5. //
  6. // This means, of course, that it'll only work if you
  7. // already have a tar implementation, and some of them
  8. // will not properly unpack the fixtures anyway.
  9. //
  10. // But, since usually those tests will fail on Windows
  11. // and other systems with less capable filesystems anyway,
  12. // at least this way we don't cause inconveniences by
  13. // merely cloning the repo or installing the package.
  14. var tap = require("tap")
  15. , child_process = require("child_process")
  16. , rimraf = require("rimraf")
  17. , test = tap.test
  18. , path = require("path")
  19. test("clean fixtures", function (t) {
  20. rimraf(path.resolve(__dirname, "fixtures"), function (er) {
  21. t.ifError(er, "rimraf ./fixtures/")
  22. t.end()
  23. })
  24. })
  25. test("clean tmp", function (t) {
  26. rimraf(path.resolve(__dirname, "tmp"), function (er) {
  27. t.ifError(er, "rimraf ./tmp/")
  28. t.end()
  29. })
  30. })
  31. test("extract fixtures", function (t) {
  32. var c = child_process.spawn("tar"
  33. ,["xzvf", "fixtures.tgz"]
  34. ,{ cwd: __dirname })
  35. c.stdout.on("data", errwrite)
  36. c.stderr.on("data", errwrite)
  37. function errwrite (chunk) {
  38. process.stderr.write(chunk)
  39. }
  40. c.on("exit", function (code) {
  41. t.equal(code, 0, "extract fixtures should exit with 0")
  42. if (code) {
  43. t.comment("Note, all tests from here on out will fail because of this.")
  44. }
  45. t.end()
  46. })
  47. })