Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ module.exports = {
testMatch: ['**/__tests__/**/*.test.js', '**/?(*.)+(spec|test).[jt]s?(x)'],
clearMocks: true,
moduleFileExtensions: ['js', 'json', 'node'],
testEnvironment: 'jsdom',
};
4 changes: 3 additions & 1 deletion js/utils/__tests__/musicutils.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { TextEncoder } = require('util');
global.TextEncoder = TextEncoder;
global._ = jest.fn((str) => str);
global.window = {
btoa: jest.fn((str) => Buffer.from(str, "utf8").toString("base64"))
Expand Down Expand Up @@ -2007,4 +2009,4 @@ describe("getSolfege", () => {
});

// TODO: Implement `pitchinfo` and `_calculate_pitch_number` methods.
// These are pending as they are related with the Activity class and DOM.
// These are pending as they are related with the Activity class and DOM.
19 changes: 19 additions & 0 deletions js/utils/__tests__/platformstyle.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
describe('Platform Style Tests', () => {
beforeEach(() => {
const meta = document.createElement('meta');
meta.name = 'theme-color';
document.head.appendChild(meta);
});

afterEach(() => {
document.head.innerHTML = '';
});

test('should set the meta theme-color content based on platformColor', () => {
const platformColor = { header: '#ff0000' };
document.querySelector("meta[name=theme-color]").content = platformColor.header;

const meta = document.querySelector("meta[name=theme-color]");
expect(meta.content).toBe('#ff0000');
});
});
Loading