mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-09 00:48:20 +08:00
CHORE: Rename js.Javascript to js.JavaScript (#2405)
This commit is contained in:
parent
83a7f06718
commit
e9b4b9b34d
3 changed files with 5 additions and 5 deletions
|
@ -122,7 +122,7 @@ func ExecuteDSL(args ExecuteDSLArgs) (*models.DNSConfig, error) {
|
|||
return nil, fmt.Errorf("no config specified")
|
||||
}
|
||||
|
||||
dnsConfig, err := js.ExecuteJavascript(args.JSFile, args.DevMode, stringSliceToMap(args.Variable))
|
||||
dnsConfig, err := js.ExecuteJavaScript(args.JSFile, args.DevMode, stringSliceToMap(args.Variable))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("executing %s: %w", args.JSFile, err)
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ var currentDirectory string
|
|||
// EnableFetch sets whether to enable fetch() in JS execution environment
|
||||
var EnableFetch bool = false
|
||||
|
||||
// ExecuteJavascript accepts a javascript file and runs it, returning the resulting dnsConfig.
|
||||
func ExecuteJavascript(file string, devMode bool, variables map[string]string) (*models.DNSConfig, error) {
|
||||
// ExecuteJavaScript accepts a javascript file and runs it, returning the resulting dnsConfig.
|
||||
func ExecuteJavaScript(file string, devMode bool, variables map[string]string) (*models.DNSConfig, error) {
|
||||
script, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -41,7 +41,7 @@ func TestParsedFiles(t *testing.T) {
|
|||
var err error
|
||||
|
||||
// Compile the .js file:
|
||||
conf, err := ExecuteJavascript(string(filepath.Join(testDir, name)), true, nil)
|
||||
conf, err := ExecuteJavaScript(string(filepath.Join(testDir, name)), true, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ func TestErrors(t *testing.T) {
|
|||
}
|
||||
for _, tst := range tests {
|
||||
t.Run(tst.desc, func(t *testing.T) {
|
||||
if _, err := ExecuteJavascript(tst.text, true, nil); err == nil {
|
||||
if _, err := ExecuteJavaScript(tst.text, true, nil); err == nil {
|
||||
t.Fatal("Expected error but found none")
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue