Skip to content

Commit

Permalink
Merge pull request #235 from SimonStnn/bugfix/small-fixes
Browse files Browse the repository at this point in the history
Small fixes
  • Loading branch information
SimonStnn authored Jun 18, 2024
2 parents 5cf0dc8 + 6e094c2 commit 8502e39
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/background/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ const updateBadgeColors = () => {

const spawnBalloon = async () => {
log.groupCollapsed(
'info',
'debug',
`(${new Date().toLocaleTimeString()}) Spawning Balloon...`
);
log.time('info', 'Spawn Time');
log.time('debug', 'Spawn Time');

const now = Date.now();
const minSpawnInterval = (await storage.sync.get('config')).spawnInterval
.min;
const skipSpawnMessage = (note: any, level: LogLevelNames = 'softwarn') => {
log[level](`Skipping spawnBalloon message: \r\n\t`, note);
log.timeEnd('info', 'Spawn Time');
log.groupEnd('info');
log.timeEnd('debug', 'Spawn Time');
log.groupEnd('debug');
};

// Check if there is a spawn timeout
Expand Down Expand Up @@ -165,8 +165,8 @@ const updateBadgeColors = () => {
log.softerror(' - Error sending spawn balloon script to tab', tab.id, e);
}
lastSpawn = now;
log.timeEnd('info', 'Spawn Time');
log.groupEnd('info');
log.timeEnd('debug', 'Spawn Time');
log.groupEnd('debug');
};

const createSpawnAlarm = async (name: AlarmName) => {
Expand Down
2 changes: 1 addition & 1 deletion src/popup/components/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default () => {
<span className="flex-grow">
<Caption />
</span>
{data.rank && (
{data.rank && data.rank <= limit * maxPages && (
<Tooltip>
<TooltipTrigger asChild>
<Button
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export async function importStylesheet(id: string, href: string) {
style.textContent = css;

// Append the <style> element to the <head>
document.head.appendChild(style);
getBalloonContainer().appendChild(style);
}
}

Expand Down
4 changes: 3 additions & 1 deletion tests/balloons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ describe('Balloons', () => {
test('all balloons have a corresponding test file', () => {
balloonNames.forEach((name) => {
const testName = `${name}.test.ts`;
expect(fs.existsSync(path.resolve(__dirname, `./balloons/${testName}`)));
expect(
fs.existsSync(path.resolve(__dirname, `./balloons/${testName}`))
).toBeTruthy();
});
});

Expand Down
23 changes: 23 additions & 0 deletions tests/balloons/confetti.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Confetti } from '@/balloons';
import fetchMock from 'jest-fetch-mock';

fetchMock.enableMocks();

describe('Confetti Balloon', () => {
let balloon: Confetti;

beforeEach(() => {
balloon = new Confetti();

fetchMock.resetMocks();
});

test('name should be "confetti"', () => {
expect(balloon.name).toBe('confetti');
});

test('name should be the same as the class name', () => {
expect(balloon.name).toBe('confetti');
expect(balloon.name).toBe(Confetti.name.toLowerCase());
});
});

0 comments on commit 8502e39

Please sign in to comment.