UNPKG

inventora-shopify-admin-api

Version:

Shopify Admin API is a NodeJS library built to help developers easily authenticate and make calls against the Shopify API. It was inspired by and borrows heavily from ShopifySharp.

54 lines 1.54 kB
{ /* Copy this snippet into your TypeScript snippets, then type 'prime-test' in a TypeScript file to create a Shopify Prime test. */ "prime-test": { "prefix": "prime-test", "body": [ "import * as Prime from '../';", "import inspect from 'logspect/bin';", "import {", "\tAsyncSetupFixture,", "\tAsyncTeardownFixture,", "\tAsyncTest,", "\tIgnoreTest,", "\tTestFixture,", "\tTimeout", "\t} from 'alsatian';", "import { Config, Expect } from './test_utils';", "", "@TestFixture(\"$1 Tests\") ", "class $1Tests {", "\tprivate service = new Prime.$1s(Config.shopDomain, Config.accessToken);", "", "\tprivate created: Prime.Models.$1[] = [];", "", "\t@AsyncTeardownFixture", "\tprivate async teardownAsync() {", "\t\tawait Promise.all(this.created.map(created => this.service.delete(created.id)));", "", "\t\tinspect(`Deleted \\${this.created.length} objects during teardown.`);", "\t}", "", "\tprivate async create(scheduleForDeletion = true) {", "\t\tconst obj = await this.service.create({", "\t\t\t$0", "\t\t});", "", "\t\tif (scheduleForDeletion) {", "\t\t\tthis.created.push(obj);", "\t\t};", "", "\t\treturn obj;", "\t}", "", "\t@AsyncTest(\"should list $1s\")", "\t@Timeout(5000)", "\tpublic async Test1() {", "\t\tconst list = await this.service.list();", "", "\t\tExpect(Array.isArray(list)).toBe(true);", "\t}", "}" ], "description": "Creates a Shopify Prime test using Alsatian." } }