11import assert from "assert" ;
22import ftl from "@fluent/dedent" ;
33
4- import { FluentBundle } from "../esm /bundle.js " ;
5- import { FluentResource } from "../esm /resource.js " ;
6- import { FluentType , FluentNumber , FluentDateTime } from "../esm /types.js " ;
4+ import { FluentBundle } from "../src /bundle.ts " ;
5+ import { FluentResource } from "../src /resource.ts " ;
6+ import { FluentType , FluentNumber , FluentDateTime } from "../src /types.ts " ;
77
88suite ( "Variables" , function ( ) {
99 let bundle , errs ;
1010
11- setup ( function ( ) {
11+ beforeEach ( function ( ) {
1212 errs = [ ] ;
1313 } ) ;
1414
1515 suite ( "in values" , function ( ) {
16- suiteSetup ( function ( ) {
16+ beforeAll ( function ( ) {
1717 bundle = new FluentBundle ( "en-US" , { useIsolating : false } ) ;
1818 bundle . addResource (
1919 new FluentResource ( ftl `
@@ -58,7 +58,7 @@ suite("Variables", function () {
5858 } ) ;
5959
6060 suite ( "in selectors" , function ( ) {
61- suiteSetup ( function ( ) {
61+ beforeAll ( function ( ) {
6262 bundle = new FluentBundle ( "en-US" , { useIsolating : false } ) ;
6363 bundle . addResource (
6464 new FluentResource ( ftl `
@@ -78,7 +78,7 @@ suite("Variables", function () {
7878 } ) ;
7979
8080 suite ( "in function calls" , function ( ) {
81- suiteSetup ( function ( ) {
81+ beforeAll ( function ( ) {
8282 bundle = new FluentBundle ( "en-US" , { useIsolating : false } ) ;
8383 bundle . addResource (
8484 new FluentResource ( ftl `
@@ -96,7 +96,7 @@ suite("Variables", function () {
9696 } ) ;
9797
9898 suite ( "simple errors" , function ( ) {
99- suiteSetup ( function ( ) {
99+ beforeAll ( function ( ) {
100100 bundle = new FluentBundle ( "en-US" , { useIsolating : false } ) ;
101101 bundle . addResource (
102102 new FluentResource ( ftl `
@@ -158,7 +158,7 @@ suite("Variables", function () {
158158 suite ( "and strings" , function ( ) {
159159 let args ;
160160
161- suiteSetup ( function ( ) {
161+ beforeAll ( function ( ) {
162162 bundle = new FluentBundle ( "en-US" , { useIsolating : false } ) ;
163163 bundle . addResource (
164164 new FluentResource ( ftl `
@@ -179,7 +179,7 @@ suite("Variables", function () {
179179 } ) ;
180180
181181 suite ( "and numbers" , function ( ) {
182- suiteSetup ( function ( ) {
182+ beforeAll ( function ( ) {
183183 bundle = new FluentBundle ( "en-US" , { useIsolating : false } ) ;
184184 bundle . addResource (
185185 new FluentResource ( ftl `
@@ -207,7 +207,7 @@ suite("Variables", function () {
207207 suite ( "and dates" , function ( ) {
208208 let dtf ;
209209
210- suiteSetup ( function ( ) {
210+ beforeAll ( function ( ) {
211211 dtf = new Intl . DateTimeFormat ( "en-US" ) ;
212212 bundle = new FluentBundle ( "en-US" , { useIsolating : false } ) ;
213213 bundle . addResource (
@@ -243,33 +243,33 @@ suite("Variables", function () {
243243 }
244244 }
245245
246- suiteSetup ( function ( ) {
246+ beforeAll ( function ( ) {
247247 bundle = new FluentBundle ( "en-US" , { useIsolating : false } ) ;
248248 bundle . addResource (
249249 new FluentResource ( ftl `
250250 foo = { $arg }
251251 bar = { foo }
252252 ` )
253253 ) ;
254+ } ) ;
254255
255- const args = {
256- // CustomType is a wrapper around the value
257- arg : new CustomType ( ) ,
258- } ;
256+ const args = {
257+ // CustomType is a wrapper around the value
258+ arg : new CustomType ( ) ,
259+ } ;
260+
261+ test ( "interpolation" , function ( ) {
262+ const msg = bundle . getMessage ( "foo" ) ;
263+ const value = bundle . formatPattern ( msg . value , args , errs ) ;
264+ assert . strictEqual ( value , "CUSTOM" ) ;
265+ assert . strictEqual ( errs . length , 0 ) ;
266+ } ) ;
259267
260- test ( "interpolation" , function ( ) {
261- const msg = bundle . getMessage ( "foo" ) ;
262- const value = bundle . formatPattern ( msg . value , args , errs ) ;
263- assert . strictEqual ( value , "CUSTOM" ) ;
264- assert . strictEqual ( errs . length , 0 ) ;
265- } ) ;
266-
267- test ( "nested interpolation" , function ( ) {
268- const msg = bundle . getMessage ( "bar" ) ;
269- const value = bundle . formatPattern ( msg . value , args , errs ) ;
270- assert . strictEqual ( value , "CUSTOM" ) ;
271- assert . strictEqual ( errs . length , 0 ) ;
272- } ) ;
268+ test ( "nested interpolation" , function ( ) {
269+ const msg = bundle . getMessage ( "bar" ) ;
270+ const value = bundle . formatPattern ( msg . value , args , errs ) ;
271+ assert . strictEqual ( value , "CUSTOM" ) ;
272+ assert . strictEqual ( errs . length , 0 ) ;
273273 } ) ;
274274 } ) ;
275275} ) ;
0 commit comments