8000 GitHub - pascalfleury/theater-scenes: TheaterScenes - Javascritp library to help deal with roles/ scenes and absences.
[go: up one dir, main page]

Skip to content

TheaterScenes - Javascritp library to help deal with roles/ scenes and absences.

License

Notifications You must be signed in to change notification settings

pascalfleury/theater-scenes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a Javascript library useful to handle theater plays, their set of scenes, acts, roles and which scenes can be played with a given subset of roles.

This is used to compute possible scenes to rehearse given the list of present actors (and the roles they can play).

Installation

You will need to first install npm on your system, so the dependencies can then be tracked with it.

Tools installation

I installed these to make the whole thing build and run with tests:

npm install --save-dev jest vite gas-tap

AppScript sync

The library is useful as a Google AppScript library. I use the clasp tool to sync to my copy of it.

sudo npm install -g @google/clasp

Typical commands to sync with it are:

clasp login
clasp clone <script_id>
clasp push

Testing with gas-tap

I was using the gas-tap from AppScript when developing on the Appscript IDE. So I kept it here.

npm install --save-dev jest gas-tap

Tests on a stand-alone need a minimum of stubbing out the infra that is provided by AppScript.

// LOCAL_ONLY START
// myFunction.test.js (using Jest as an example)
const { test } = require('gas-tap'); // Import gas-tap's test function

// Mock the Apps Script Logger (or other services)
global.Logger = {
  log: jest.fn(), // Create a mock log function
};
// LOCAL_ONLY END

// Your test
test('myFunction should return correct greeting', () => {
  const myFunction = require('../src/myFunction'); // Your code
  const result = myFunction('Test');
  expect(result).toBe('Hello, Test!');
  expect(Logger.log).toHaveBeenCalledWith('Hello, Test!'); // Check the log
});

// Run your tests with Jest:
// npm test

If the tests are simple, the only thing that needs stubbing is the Logger:

// test.js (or wherever you run your tests)
global.Logger = {
  log: () => {}, // Empty function (or you could console.log here)
};

About

TheaterScenes - Javascritp library to help deal with roles/ scenes and absences.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0