Skip to content

Commit

Permalink
Fix ThemeManager specs
Browse files Browse the repository at this point in the history
  • Loading branch information
savetheclocktower committed Mar 8, 2025
1 parent f6be9bf commit 5c682fc
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions spec/theme-manager-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ async function timeout(ms) {
return new Promise((_, reject) => setTimeout(reject, ms, new Error('Timeout')));
}

async function waitForCondition(func, { intervalMs = 50, timeoutMs = 5000 } = {}) {
async function waitForCondition(
func,
{
intervalMs = 50,
timeoutMs = jasmine.getEnv().defaultTimeoutInterval
} = {}
) {
let attempt = new Promise((resolve) => {
const retryer = () => {
if (func()) {
Expand All @@ -28,7 +34,7 @@ async function waitForCondition(func, { intervalMs = 50, timeoutMs = 5000 } = {}
}


describe('atom.themes', () => {
fdescribe('atom.themes', () => {
beforeEach(() => {
jasmine.useRealClock();
spyOn(atom, 'inSpecMode').andReturn(false);
Expand Down Expand Up @@ -464,12 +470,12 @@ h2 {

expect(styleElementRemovedHandler).toHaveBeenCalled();
expect(
styleElementRemovedHandler.argsForCall[0][0].textContent
styleElementRemovedHandler.argsForCall[0]?.[0].textContent
).toContain('dotted');

expect(styleElementAddedHandler).toHaveBeenCalled();
expect(
styleElementAddedHandler.argsForCall[0][0].textContent
styleElementAddedHandler.argsForCall[0]?.[0].textContent
).toContain('dashed');

styleElementRemovedHandler.reset();
Expand Down Expand Up @@ -512,11 +518,9 @@ h2 {
beforeEach(() => {
jasmine.useRealClock();
addErrorHandler = jasmine.createSpy();
const { File } = require('pathwatcher');
spyOn(File.prototype, 'on').andCallFake(function (event) {
if (event.indexOf('contents-changed') > -1) {
throw new Error('Unable to watch path');
}
const watcher = require('../src/path-watcher');
spyOn(watcher, 'watchPath').andCallFake(() => {
throw new Error('Unable to watch path');
});
spyOn(atom.themes, 'loadStylesheet').andReturn('');
atom.notifications.onDidAddNotification(addErrorHandler);
Expand Down

0 comments on commit 5c682fc

Please sign in to comment.