Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Nov 20, 2024
1 parent bec4ea9 commit 1b69557
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/helpers/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require('chai').should();
const Hexo = require('hexo');
const hexo = new Hexo();

const fontStyles = ':300,300italic,400,400italic,700,700italic';
const fontStyles = ':ital,wght@0,300;0,400;0,700;1,300;1,400;1,700';
const fontHost = 'https://fonts.googleapis.com';

describe('font', () => {
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('font', () => {
family : 'Palatino',
external: false
};
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css?family=Amatic+SC${fontStyles}&display=swap&subset=latin,latin-ext">`);
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css2?family=Amatic+SC${fontStyles}&display=swap&subset=latin,latin-ext">`);
});

it('multiple', () => {
Expand All @@ -55,7 +55,7 @@ describe('font', () => {
family : 'Palatino',
external: true
};
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css?family=Amatic+SC${fontStyles}%7CPalatino${fontStyles}&display=swap&subset=latin,latin-ext">`);
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css2?family=Amatic+SC${fontStyles}&family=Palatino${fontStyles}&display=swap&subset=latin,latin-ext">`);
});

it('duplicate', () => {
Expand All @@ -68,7 +68,7 @@ describe('font', () => {
family : 'Palatino',
external: true
};
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css?family=Palatino${fontStyles}&display=swap&subset=latin,latin-ext">`);
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css2?family=Palatino${fontStyles}&display=swap&subset=latin,latin-ext">`);
});

it('fallback font', () => {
Expand All @@ -81,6 +81,6 @@ describe('font', () => {
family : 'Palatino',
external: true
};
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css?family=Roboto+Slab${fontStyles}%7CNoto+Serif+SC${fontStyles}%7CPalatino${fontStyles}&display=swap&subset=latin,latin-ext">`);
nextFont().should.eql(`<link rel="stylesheet" href="${fontHost}/css2?family=Roboto+Slab${fontStyles}&family=Noto+Serif+SC${fontStyles}&family=Palatino${fontStyles}&display=swap&subset=latin,latin-ext">`);
});
});

0 comments on commit 1b69557

Please sign in to comment.