github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/webapp/components_handler_test.go (about)

     1  // +build small
     2  
     3  // Copyright 2018 The WPT Dashboard Project. All rights reserved.
     4  // Use of this source code is governed by a BSD-style license that can be
     5  // found in the LICENSE file.
     6  
     7  package webapp
     8  
     9  import (
    10  	"testing"
    11  
    12  	"github.com/stretchr/testify/assert"
    13  )
    14  
    15  func TestPackageRegex(t *testing.T) {
    16  	assert.True(t, packageRegex.MatchString(`import '@polymer/Stuff';`))
    17  	assert.True(t, packageRegex.MatchString(`import "@polymer/Stuff";`))
    18  	assert.True(t, packageRegex.MatchString(`import { Cats, Dogs } from '@polymer/Animals';`))
    19  	assert.True(t, packageRegex.MatchString(`import { Cats, Dogs } from "@polymer/Animals";`))
    20  	assert.True(t, packageRegex.MatchString(`import '@polymer/polymer/lib/utils/gestures.js'`))
    21  	assert.True(t, packageRegex.MatchString(`import "@polymer/polymer/lib/utils/gestures.js"`))
    22  	assert.True(t, packageRegex.MatchString(`import * as gestures from '@polymer/polymer/lib/utils/gestures.js';`))
    23  	assert.True(t, packageRegex.MatchString(`import * as gestures from "@polymer/polymer/lib/utils/gestures.js";`))
    24  
    25  	assert.False(t, packageRegex.MatchString(`function import() { return "no" };`))
    26  }