{"id":20535697,"url":"https://github.com/vlucas/gasmask","last_synced_at":"2025-08-20T16:31:17.802Z","repository":{"id":43742552,"uuid":"322967699","full_name":"vlucas/gasmask","owner":"vlucas","description":"Mocks for Google Apps Script libraries, specifically around Spreadsheets","archived":false,"fork":false,"pushed_at":"2024-07-18T19:23:58.000Z","size":380,"stargazers_count":23,"open_issues_count":0,"forks_count":8,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-12-06T00:09:20.804Z","etag":null,"topics":["google","google-apps-script","hacktoberfest","mocks","testing","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vlucas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-20T00:58:45.000Z","updated_at":"2024-09-05T14:16:21.000Z","dependencies_parsed_at":"2024-06-21T16:52:19.909Z","dependency_job_id":"d9ae979f-b4c8-4e01-b9f6-4020c15a5697","html_url":"https://github.com/vlucas/gasmask","commit_stats":{"total_commits":46,"total_committers":2,"mean_commits":23.0,"dds":0.04347826086956519,"last_synced_commit":"d81d7404d413528ffc53e341d33cd13cd441b510"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlucas%2Fgasmask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlucas%2Fgasmask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlucas%2Fgasmask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlucas%2Fgasmask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vlucas","download_url":"https://codeload.github.com/vlucas/gasmask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230023040,"owners_count":18161097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google","google-apps-script","hacktoberfest","mocks","testing","testing-tools"],"created_at":"2024-11-16T00:33:30.310Z","updated_at":"2024-12-19T13:07:12.349Z","avatar_url":"https://github.com/vlucas.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GASMask\n\nMocks and stubs/dummies for Google Apps Script (GAS).\n\n## Why?\n\nGoogle Apps Script add-ons (like [BudgetSheet](https://www.budgetsheet.net) - the add-on I am developing) make a of\ncalls to globally available APIs that Google provides to your scripts. Unfortunately, Google does not provide any\nstandard mocking library for these APIs, so individual library authors are left to mock those global libraries\nthemselves in order to make their code unit testable.\n\n## Focus\n\nFor now, the focus of this library is around **SpreadsheetApp** since that is the specific Google add-on I am\ndelevoping. The eventual goal is to cover most or all of the Google Apps Script APIs with full type support, with\ncommunity support.\n\n## Installation\n\nTo use `gasmask` install it in your project as a devDependency:\n\n```\nnpm i gasmask -D\n```\n\nNow you are ready to get started using gasmask in your tests.\n\n## Usage\n\nAssuming you are trying to test a method that shows a simple toast message:\n\n```javascript\n  function showToastMessage(msg, title) {\n    const ss = SpreadsheetApp.getActiveSpreadsheet();\n\n    ss.toast(msg, title || 'My Add-On');\n  },\n```\n\nJust import what you need to use in your tests:\n\n```javascript\nimport { Spreadsheet } from 'gasmask';\n\ndescribe('showToastMessage', () =\u003e {\n  it('should display a toast message to the user', () =\u003e {\n    const testMessage = 'test message here';\n    const mockToast = jest.spyOn(Spreadsheet, 'toast'); // Spy the 'Spreadsheet.toast' method to ensure it gets called\n\n    // Call our method\n    showToastMessage(testMessage);\n\n    // Now we ensure that it was called with the correct arguments\n    expect(mockToast).toBeCalledWith(testMessage, 'My Add-On');\n  });\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlucas%2Fgasmask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvlucas%2Fgasmask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlucas%2Fgasmask/lists"}