WordcountTests.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import Client from './helpers/Client.js'
  2. import { expect } from 'chai'
  3. import path from 'node:path'
  4. import fs from 'node:fs'
  5. import ClsiApp from './helpers/ClsiApp.js'
  6. describe('Syncing', function () {
  7. before(async function () {
  8. this.request = {
  9. resources: [
  10. {
  11. path: 'main.tex',
  12. content: fs.readFileSync(
  13. path.join(import.meta.dirname, '../fixtures/naugty_strings.txt'),
  14. 'utf-8'
  15. ),
  16. },
  17. ],
  18. }
  19. this.project_id = Client.randomId()
  20. await ClsiApp.ensureRunning()
  21. this.body = await Client.compile(this.project_id, this.request)
  22. })
  23. describe('wordcount file', function () {
  24. it('should return wordcount info', async function () {
  25. const result = await Client.wordcount(this.project_id, 'main.tex')
  26. expect(result).to.deep.equal({
  27. texcount: {
  28. encode: 'utf8',
  29. textWords: 2281,
  30. headWords: 2,
  31. outside: 0,
  32. headers: 2,
  33. elements: 0,
  34. mathInline: 6,
  35. mathDisplay: 0,
  36. errors: 0,
  37. messages: '',
  38. },
  39. })
  40. })
  41. })
  42. })