Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public lualibRequire() {
// Transpile
let lua = util.transpileString(``, {dontRequireLuaLib: false, luaTarget: "JIT"});
// Assert
Expect(dedent(lua)).toBe(`require("typescript_lualib")`);
}
}
public claimIdIgnoresId(work: Work) {
// The field .id is ignored in the calculation of the id
const ignoreId = getClaimId({
...work,
id: '123'
})
Expect(ignoreId).toBe(work.id)
}
public claimIdIgnoresId(work: Work) {
// The field .id is ignored in the calculation of the id
const ignoreId = getClaimId({
...work,
id: '123',
})
Expect(ignoreId).toBe(work.id)
}
import { Expect, Test, TestCase } from "alsatian";
import { findConfigFile, parseCommandLine } from "../../src/CommandLineParser";
export class CLITests {
@Test("defaultOption")
@TestCase("luaTarget", "JIT")
@TestCase("noHeader", false)
@TestCase("luaLibImport", "inline")
@TestCase("rootDir", process.cwd())
@TestCase("outDir", process.cwd())
public defaultOptions(option: any, expected: any): void {
const parsedCommandLine = parseCommandLine([]);
Expect(expected).toBe(parsedCommandLine.options[option]);
}
@Test("ValidLuaTarget")
public validLuaTarget(): void {
const parsedCommandLine = parseCommandLine(['--luaTarget', '5.3']);
Expect(parsedCommandLine.options["luaTarget"]).toBe("5.3");
}
@Test("InvalidLuaTarget")
public invalidLuaTarget(): void {
// Don't check error message because the yargs library messes the message up.
Expect(() => parseCommandLine(['--luaTarget', '42'])).toThrow();
import { Expect, Test, TestCase } from "alsatian";
import { findConfigFile, parseCommandLine } from "../../src/CommandLineParser";
export class CLITests {
@Test("defaultOption")
@TestCase("luaTarget", "JIT")
@TestCase("noHeader", false)
@TestCase("luaLibImport", "inline")
@TestCase("rootDir", process.cwd())
@TestCase("outDir", process.cwd())
public defaultOptions(option: any, expected: any): void {
const parsedCommandLine = parseCommandLine([]);
Expect(expected).toBe(parsedCommandLine.options[option]);
}
@Test("ValidLuaTarget")
public validLuaTarget(): void {
const parsedCommandLine = parseCommandLine(['--luaTarget', '5.3']);
Expect(parsedCommandLine.options["luaTarget"]).toBe("5.3");
}
@Test("InvalidLuaTarget")
public invalidLuaTarget(): void {
// Don't check error message because the yargs library messes the message up.
* Called once after every test
*/
@Teardown
public teardown() {
debug("teardown:+");
// Add code
debug("teardown:-");
}
/**
* An example synchronous test which adds two numbers using TypeScript
*/
@TestCase(1, 2, 3)
@TestCase(-1, 2, 1)
@TestCase(0, 0, 0)
@Test("Test adding two numbers using TypeScript")
public testAddTwoTypeScript(val1: number, val2: number, expectedResult: number) {
debug("testAddTwoTypeScript:+");
Expect(val1 + val2).toBe(expectedResult);
debug("testAddTwoTypeScript:-");
}
/**
* Test TurboScript can add numbers
*/
@TestCase(1, 2, 3)
@TestCase(-1, 2, 1)
@TestCase(0, 0, 0)
TestFixture,
Timeout
} from 'alsatian';
import { Config, Expect } from './test_utils';
@TestFixture("Application Credits")
export class ApplicationCreditTests {
@AsyncTest("Creates an application credit")
@IgnoreTest("Cannot be tested with a private app.")
public async Test1() { }
@AsyncTest("Gets an application credit")
@IgnoreTest("Cannot be tested with a private app.")
public async Test2() { }
@AsyncTest("Lists application credits")
@IgnoreTest("Cannot be tested with a private app.")
public async Test3() { }
}
Expect(shop.force_ssl).toBeType("boolean");
Expect(shop.shop_owner).toBeType("string");
Expect(shop.myshopify_domain).toBeType("string");
}
@AsyncTest("should get a shop with only a name field")
@Timeout(5000)
public async Test2() {
const shop = await this.service.get({ fields: "name" });
Expect(shop).not.toBeNull();
Expect(Object.getOwnPropertyNames(shop).length).toEqual(1);
Expect(shop.name).toBeType("string");
}
@AsyncTest("should force uninstall the app")
@IgnoreTest("cannot be tested with a private app")
public async Test3() { }
}
TestFixture,
Timeout
} from 'alsatian';
import { Config, Expect } from './test_utils';
@TestFixture("Charge Tests")
export class ChargeTests {
@AsyncTest("should list charges,")
@IgnoreTest("Cannot be tested with a private app.")
public async Test1() { }
@AsyncTest("should get a charge")
@IgnoreTest("Cannot be tested with a private app.")
public async Test2() { }
@AsyncTest("should create a charge")
@IgnoreTest("Cannot be tested with a private app.")
public async Test3() { }
@AsyncTest("should activate a charge")
@IgnoreTest("Cannot be tested with a private app.")
public async Test4() { }
}
TestFixture,
Timeout
} from 'alsatian';
import { Config, Expect } from './test_utils';
@TestFixture("Discount Tests")
export class DiscountTests {
@AsyncTest("should create a Discount")
@IgnoreTest("cannot be tested without a Shopify Plus account.")
public async Test1() { }
@AsyncTest("should get a Discount")
@IgnoreTest("cannot be tested without a Shopify Plus account.")
public async Test2() { }
@AsyncTest("should list Discounts,")
@IgnoreTest("annot be tested without a Shopify Plus account.")
public async Test3() { }
@AsyncTest("should delete a Discount")
@IgnoreTest("cannot be tested without a Shopify Plus account.")
public async Test4() { }
@AsyncTest("should enable a Discount")
@IgnoreTest("cannot be tested without a Shopify Plus account.")
public async Test5() { }
@AsyncTest("should disable a Discount")
@IgnoreTest("cannot be tested without a Shopify Plus account.")
public async Test6() { }
}