Skip to content

Commit

Permalink
chore(test/extend/tag): async function (#3328) (#5003)
Browse files Browse the repository at this point in the history
  • Loading branch information
renbaoshuo authored Jun 30, 2022
1 parent ccbed65 commit 104b721
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/scripts/extend/tag.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const { spy } = require('sinon');
const Promise = require('bluebird');

describe('Tag', () => {
const Tag = require('../../../lib/extend/tag');
Expand All @@ -19,7 +18,7 @@ describe('Tag', () => {
it('register() - async', async () => {
const tag = new Tag();

tag.register('test', (args, content) => Promise.resolve(args.join(' ')), { async: true });
tag.register('test', async (args, content) => args.join(' '), { async: true });

const result = await tag.render('{% test foo bar %}');
result.should.eql('foo bar');
Expand All @@ -43,7 +42,7 @@ describe('Tag', () => {
it('register() - async block', async () => {
const tag = new Tag();

tag.register('test', (args, content) => Promise.resolve(args.join(' ') + ' ' + content), { ends: true, async: true });
tag.register('test', async (args, content) => args.join(' ') + ' ' + content, { ends: true, async: true });

const str = [
'{% test foo bar %}',
Expand Down Expand Up @@ -81,9 +80,7 @@ describe('Tag', () => {
const tag = new Tag();

tag.register('test', (args, content) => content, {ends: true, async: true});
tag.register('async', (args, content) => {
return Promise.resolve(args.join(' ') + ' ' + content);
}, { ends: true, async: true });
tag.register('async', async (args, content) => args.join(' ') + ' ' + content, { ends: true, async: true });

const str = [
'{% test %}',
Expand Down Expand Up @@ -136,7 +133,7 @@ describe('Tag', () => {
it('unregister()', () => {
const tag = new Tag();

tag.register('test', (args, content) => Promise.resolve(args.join(' ')), {async: true});
tag.register('test', async (args, content) => args.join(' '), {async: true});
tag.unregister('test');

return tag.render('{% test foo bar %}')
Expand Down

0 comments on commit 104b721

Please sign in to comment.